···77# arguments:
88# * ghc package to use
99# * package-set: a function that takes { pkgs, stdenv, callPackage } as first arg and `self` as second
1010-{ ghc, package-set }:
1010+# * extensible-self: the final, fully overriden package set usable with the nixpkgs fixpoint overriding functionality
1111+{ ghc, package-set, extensible-self }:
11121213# return value: a function from self to the package set
1314self: let
···127128 then self.callCabal2nix
128129 else self.callHackage;
129130 in generateExprs name src {}) overrides;
131131+132132+ # : { root : Path, source-overrides : Defaulted (Either Path VersionNumber } -> NixShellAwareDerivation
133133+ # Given a path to a haskell package directory whose cabal file is
134134+ # named the same as the directory name, and an optional set of
135135+ # source overrides as appropriate for the 'packageSourceOverrides'
136136+ # function, return a derivation appropriate for nix-build or nix-shell
137137+ # to build that package.
138138+ developPackage = { root, source-overrides ? {} }:
139139+ let name = builtins.baseNameOf root;
140140+ drv =
141141+ (extensible-self.extend (self.packageSourceOverrides source-overrides)).callCabal2nix name root {};
142142+ in if pkgs.lib.inNixShell then drv.env else drv;
130143131144 ghcWithPackages = selectFrom: withPackages (selectFrom self);
132145