6

In my .nix file I have packages foo and bar, with bar depending on foo:

let
  haskellPackages = reflex-platform.ghcjs.override {
    overrides = self: super: {
      foo =
        pkgs.haskell.lib.dontCheck
          (pkgs.haskell.lib.dontHaddock
             (self.callCabal2nix "foo" ./foo { }));
      bar = self.callCabal2nix "bar" ./bar { };
    };
  };

in
  haskellPackages.bar

How can I disable building executables contained in foo? I only want to build the library.

I tried overrideCabal, but without luck. This still builds the foo executable:

let
  haskellPackages = reflex-platform.ghcjs.override {
    overrides = self: super: {
      foo =
        pkgs.haskell.lib.overrideCabal
          (pkgs.haskell.lib.dontCheck
             (pkgs.haskell.lib.dontHaddock
                (self.callCabal2nix "foo" ./foo { })));
          (drv: { isExecutable = false; });
      bar = self.callCabal2nix "bar" ./bar { };
    };
  };

in
  haskellPackages.bar

I can reproduce the same problem with GHC instead of GHCJS.

Emily
  • 2,577
  • 18
  • 38

1 Answers1

1

In your example you could use:

foo = pkgs.haskell.lib.compose.setBuildTarget "lib:foo" (...)

There are a handful of similar functions available:

pkgs.haskell.lib.compose.setBuildTargets
pkgs.haskell.lib.compose.setBuildTarget
pkgs.haskell.lib.setBuildTargets
pkgs.haskell.lib.setBuildTarget
Johannes Gerer
  • 25,508
  • 5
  • 29
  • 35