Merge pull request #44424 from dhess/callCaball2nixWithOption

haskell-modules: add callCabal2nixWithOptions.
This commit is contained in:
Bas van Dijk 2018-09-11 09:00:03 +02:00 committed by GitHub
commit d05a8bb410
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -177,19 +177,22 @@ in package-set { inherit pkgs stdenv callPackage; } self // {
callHackage = name: version: callPackageKeepDeriver (self.hackage2nix name version);
# Creates a Haskell package from a source package by calling cabal2nix on the source.
callCabal2nix = name: src: args: let
filter = path: type:
pkgs.lib.hasSuffix "${name}.cabal" path ||
baseNameOf path == "package.yaml";
expr = self.haskellSrc2nix {
inherit name;
src = if pkgs.lib.canCleanSource src
then pkgs.lib.cleanSourceWith { inherit src filter; }
else src;
};
in overrideCabal (callPackageKeepDeriver expr args) (orig: {
inherit src;
});
callCabal2nixWithOptions = name: src: extraCabal2nixOptions: args:
let
filter = path: type:
pkgs.lib.hasSuffix "${name}.cabal" path ||
baseNameOf path == "package.yaml";
expr = self.haskellSrc2nix {
inherit name extraCabal2nixOptions;
src = if pkgs.lib.canCleanSource src
then pkgs.lib.cleanSourceWith { inherit src filter; }
else src;
};
in overrideCabal (callPackageKeepDeriver expr args) (orig: {
inherit src;
});
callCabal2nix = name: src: args: self.callCabal2nixWithOptions name src "" args;
# : { root : Path
# , source-overrides : Defaulted (Either Path VersionNumber)