diff --git a/pkgs/development/haskell-modules/make-package-set.nix b/pkgs/development/haskell-modules/make-package-set.nix index e599b56545d9..52988dc4cbbe 100644 --- a/pkgs/development/haskell-modules/make-package-set.nix +++ b/pkgs/development/haskell-modules/make-package-set.nix @@ -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: