mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 06:45:16 +01:00
callCabal2nix: Don't rebuild unchanged cabal file
It can be quite annoying that callCabal2nix will build a new derivation if anything in the source has changed, even if the cabal file hasn't.
This commit is contained in:
parent
64218d61fc
commit
24b47526ce
1 changed files with 8 additions and 1 deletions
|
@ -84,7 +84,14 @@ let
|
|||
callHackage = name: version: self.callPackage (hackage2nix name version);
|
||||
|
||||
# Creates a Haskell package from a source package by calling cabal2nix on the source.
|
||||
callCabal2nix = name: src: self.callPackage (haskellSrc2nix { inherit src name; });
|
||||
callCabal2nix = name: src: args:
|
||||
let
|
||||
# Filter out files other than the cabal file. This ensures
|
||||
# that we don't create new derivations even when the cabal
|
||||
# file hasn't changed.
|
||||
justCabal = builtins.filterSource (path: type: pkgs.lib.hasSuffix ".cabal" path) src;
|
||||
drv = self.callPackage (haskellSrc2nix { inherit name; src = justCabal; }) args;
|
||||
in overrideCabal drv (drv': { inherit src; }); # Restore the desired src.
|
||||
|
||||
ghcWithPackages = selectFrom: withPackages (selectFrom self);
|
||||
|
||||
|
|
Loading…
Reference in a new issue