diff options
author | Will Fancher <elvishjerricco@gmail.com> | 2017-10-24 03:00:07 -0400 |
---|---|---|
committer | Will Fancher <elvishjerricco@gmail.com> | 2017-10-24 03:00:07 -0400 |
commit | aadbef00bd083fe59977205b2fc330cf17d09e6f (patch) | |
tree | 65828f4059d7e353edf15b29fb0c82b69fd18985 /pkgs/development/haskell-modules | |
parent | cccee1ddb7fc34e3ee4e549cdcc4e07d34a0f9f6 (diff) | |
download | nixlib-aadbef00bd083fe59977205b2fc330cf17d09e6f.tar nixlib-aadbef00bd083fe59977205b2fc330cf17d09e6f.tar.gz nixlib-aadbef00bd083fe59977205b2fc330cf17d09e6f.tar.bz2 nixlib-aadbef00bd083fe59977205b2fc330cf17d09e6f.tar.lz nixlib-aadbef00bd083fe59977205b2fc330cf17d09e6f.tar.xz nixlib-aadbef00bd083fe59977205b2fc330cf17d09e6f.tar.zst nixlib-aadbef00bd083fe59977205b2fc330cf17d09e6f.zip |
callCabal2nix: Don't rebuild unchanged cabal file (Fixed #23880)
Diffstat (limited to 'pkgs/development/haskell-modules')
-rw-r--r-- | pkgs/development/haskell-modules/make-package-set.nix | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/pkgs/development/haskell-modules/make-package-set.nix b/pkgs/development/haskell-modules/make-package-set.nix index d84167008d93..c234ff3e7802 100644 --- a/pkgs/development/haskell-modules/make-package-set.nix +++ b/pkgs/development/haskell-modules/make-package-set.nix @@ -144,7 +144,22 @@ in package-set { inherit pkgs stdenv callPackage; } self // { callHackage = name: version: self.callPackage (self.hackage2nix name version); # Creates a Haskell package from a source package by calling cabal2nix on the source. - callCabal2nix = name: src: self.callPackage (self.haskellSrc2nix { inherit src name; }); + callCabal2nix = name: src: args: if builtins.typeOf src != "path" + then self.callPackage (haskellSrc2nix { inherit name src; }) args + else + # When `src` is a Nix path literal, only use `cabal2nix` on + # the cabal file, so that the "import-from-derivation" is only + # recomputed when the cabal file changes, and so your source + # code isn't duplicated into the nix store on every change. + # This can only be done when `src` is a Nix path literal + # because that is the only kind of source that + # `builtins.filterSource` works on. But this filtering isn't + # usually important on other kinds of sources, like + # `fetchFromGitHub`. + overrideCabal (self.callPackage (haskellSrc2nix { + inherit name; + src = builtins.filterSource (path: type: pkgs.lib.hasSuffix ".cabal" path) src; + }) args) (_: { inherit src; }); # : Map Name (Either Path VersionNumber) -> HaskellPackageOverrideSet # Given a set whose values are either paths or version strings, produces |