···7# arguments:
8# * ghc package to use
9# * package-set: a function that takes { pkgs, stdenv, callPackage } as first arg and `self` as second
10-{ ghc, package-set }:
01112# return value: a function from self to the package set
13self: let
···127 then self.callCabal2nix
128 else self.callHackage;
129 in generateExprs name src {}) overrides;
000000000000130131 ghcWithPackages = selectFrom: withPackages (selectFrom self);
132
···7# arguments:
8# * ghc package to use
9# * package-set: a function that takes { pkgs, stdenv, callPackage } as first arg and `self` as second
10+# * extensible-self: the final, fully overriden package set usable with the nixpkgs fixpoint overriding functionality
11+{ ghc, package-set, extensible-self }:
1213# return value: a function from self to the package set
14self: let
···128 then self.callCabal2nix
129 else self.callHackage;
130 in generateExprs name src {}) overrides;
131+132+ # : { root : Path, source-overrides : Defaulted (Either Path VersionNumber } -> NixShellAwareDerivation
133+ # Given a path to a haskell package directory whose cabal file is
134+ # named the same as the directory name, and an optional set of
135+ # source overrides as appropriate for the 'packageSourceOverrides'
136+ # function, return a derivation appropriate for nix-build or nix-shell
137+ # to build that package.
138+ developPackage = { root, source-overrides ? {} }:
139+ let name = builtins.baseNameOf root;
140+ drv =
141+ (extensible-self.extend (self.packageSourceOverrides source-overrides)).callCabal2nix name root {};
142+ in if pkgs.lib.inNixShell then drv.env else drv;
143144 ghcWithPackages = selectFrom: withPackages (selectFrom self);
145