haskell-modules: add callCabal2nixWithOptions.

Fixes #44377.
This commit is contained in:
Drew Hess 2018-08-03 12:55:29 -07:00
parent ce4e1a15bc
commit 4abb8be7ab
No known key found for this signature in database
GPG Key ID: DEDAB57E001BD839

@ -170,19 +170,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)