diff options
Diffstat (limited to 'pkgs/development/haskell-modules')
-rw-r--r-- | pkgs/development/haskell-modules/make-package-set.nix | 16 | ||||
-rw-r--r-- | pkgs/development/haskell-modules/package-list.nix | 8 |
2 files changed, 21 insertions, 3 deletions
diff --git a/pkgs/development/haskell-modules/make-package-set.nix b/pkgs/development/haskell-modules/make-package-set.nix index 86f29e73113..80dc94af4df 100644 --- a/pkgs/development/haskell-modules/make-package-set.nix +++ b/pkgs/development/haskell-modules/make-package-set.nix @@ -384,6 +384,18 @@ in package-set { inherit pkgs lib callPackage; } self // { # for the "shellFor" environment (ensuring that any test/benchmark # dependencies for "foo" will be available within the nix-shell). , genericBuilderArgsModifier ? (args: args) + + # Extra dependencies, in the form of cabal2nix build attributes. + # + # An example use case is when you have Haskell scripts that use + # libraries that don't occur in your packages' dependencies. + # + # Example: + # + # extraDependencies = p: { + # libraryHaskellDepends = [ p.releaser ]; + # }; + , extraDependencies ? p: {} , ... } @ args: let @@ -474,7 +486,7 @@ in package-set { inherit pkgs lib callPackage; } self // { # See the Note in `zipperCombinedPkgs` for what gets filtered out from # each of these dependency lists. packageInputs = - pkgs.lib.zipAttrsWith (_name: zipperCombinedPkgs) cabalDepsForSelected; + pkgs.lib.zipAttrsWith (_name: zipperCombinedPkgs) (cabalDepsForSelected ++ [ (extraDependencies self) ]); # A attribute set to pass to `haskellPackages.mkDerivation`. # @@ -514,7 +526,7 @@ in package-set { inherit pkgs lib callPackage; } self // { # pkgWithCombinedDepsDevDrv :: Derivation pkgWithCombinedDepsDevDrv = pkgWithCombinedDeps.envFunc { inherit withHoogle; }; - mkDerivationArgs = builtins.removeAttrs args [ "genericBuilderArgsModifier" "packages" "withHoogle" "doBenchmark" ]; + mkDerivationArgs = builtins.removeAttrs args [ "genericBuilderArgsModifier" "packages" "withHoogle" "doBenchmark" "extraDependencies" ]; in pkgWithCombinedDepsDevDrv.overrideAttrs (old: mkDerivationArgs // { nativeBuildInputs = old.nativeBuildInputs ++ mkDerivationArgs.nativeBuildInputs or []; diff --git a/pkgs/development/haskell-modules/package-list.nix b/pkgs/development/haskell-modules/package-list.nix index 64f4be3a772..688844bcc46 100644 --- a/pkgs/development/haskell-modules/package-list.nix +++ b/pkgs/development/haskell-modules/package-list.nix @@ -1,10 +1,16 @@ { runCommand, haskellPackages, lib, all-cabal-hashes, writeShellScript }: let + # Checks if the version looks like a Haskell PVP version which is the format + # Hackage enforces. This will return false if the version strings is empty or + # we've overridden the package to ship an unstable version of the package + # (sadly there's no good way to show something useful on hackage in this case). + isPvpVersion = v: builtins.match "([0-9]+)(\\.[0-9]+)*" v != null; + pkgLine = name: pkg: let version = pkg.version or ""; in - if version != "" then + if isPvpVersion version then ''"${name}","${version}","http://hydra.nixos.org/job/nixpkgs/trunk/haskellPackages.${name}.x86_64-linux"'' else ""; all-haskellPackages = builtins.toFile "all-haskellPackages" (lib.concatStringsSep "\n" (lib.filter (x: x != "") (lib.mapAttrsToList pkgLine haskellPackages))); |