Merge branch 'callCabal2nix-cleanSourceWith'
This commit is contained in:
commit
fb069b77ee
@ -142,24 +142,16 @@ in package-set { inherit pkgs stdenv callPackage; } self // {
|
|||||||
callHackage = name: version: self.callPackage (self.hackage2nix name version);
|
callHackage = name: version: self.callPackage (self.hackage2nix name version);
|
||||||
|
|
||||||
# Creates a Haskell package from a source package by calling cabal2nix on the source.
|
# Creates a Haskell package from a source package by calling cabal2nix on the source.
|
||||||
callCabal2nix = name: src: args: if builtins.typeOf src != "path"
|
callCabal2nix = name: src: args:
|
||||||
then self.callPackage (haskellSrc2nix { inherit name src; }) args
|
overrideCabal (self.callPackage (haskellSrc2nix {
|
||||||
else
|
inherit name;
|
||||||
# When `src` is a Nix path literal, only use `cabal2nix` on
|
src = pkgs.lib.cleanSourceWith
|
||||||
# the cabal file, so that the "import-from-derivation" is only
|
{ inherit src;
|
||||||
# recomputed when the cabal file changes, and so your source
|
filter = path: type:
|
||||||
# code isn't duplicated into the nix store on every change.
|
pkgs.lib.hasSuffix "${name}.cabal" path ||
|
||||||
# This can only be done when `src` is a Nix path literal
|
pkgs.lib.hasSuffix "package.yaml" path;
|
||||||
# because that is the only kind of source that
|
};
|
||||||
# `builtins.filterSource` works on. But this filtering isn't
|
}) args) (_: { inherit src; });
|
||||||
# usually important on other kinds of sources, like
|
|
||||||
# `fetchFromGitHub`.
|
|
||||||
overrideCabal (self.callPackage (haskellSrc2nix {
|
|
||||||
inherit name;
|
|
||||||
src = builtins.filterSource (path: type:
|
|
||||||
pkgs.lib.hasSuffix "${name}.cabal" path || pkgs.lib.hasSuffix "package.yaml" path
|
|
||||||
) src;
|
|
||||||
}) args) (_: { inherit src; });
|
|
||||||
|
|
||||||
# : Map Name (Either Path VersionNumber) -> HaskellPackageOverrideSet
|
# : Map Name (Either Path VersionNumber) -> HaskellPackageOverrideSet
|
||||||
# Given a set whose values are either paths or version strings, produces
|
# Given a set whose values are either paths or version strings, produces
|
||||||
|
Loading…
Reference in New Issue
Block a user