When building a Haskell dependency with Nix, how to avoid building executables?

Viewed 220

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.

0 Answers
Related