Add packageSourceOverrides function to haskell package sets

This commit is contained in:
Shea Levy 2017-06-10 19:36:14 -04:00
parent da690bdf2d
commit 219bb1c80c

View File

@ -116,6 +116,18 @@ in package-set { inherit pkgs stdenv callPackage; } self // {
# Creates a Haskell package from a source package by calling cabal2nix on the source.
callCabal2nix = name: src: self.callPackage (self.haskellSrc2nix { inherit src name; });
# : Map Name (Either Path VersionNumber) -> HaskellPackageOverrideSet
# Given a set whose values are either paths or version strings, produces
# a package override set (i.e. (self: super: { etc. })) that sets
# the packages named in the input set to the corresponding versions
packageSourceOverrides =
overrides: self: super: pkgs.lib.mapAttrs (name: src:
let isPath = x: builtins.substring 0 1 (toString x) == "/";
generateExprs = if isPath src
then self.callCabal2nix
else self.callHackage;
in generateExprs name src {}) overrides;
ghcWithPackages = selectFrom: withPackages (selectFrom self);
ghcWithHoogle = selectFrom: