3
0
Fork 0
forked from mirrors/nixpkgs

Add haskellPackages.developPackage for local development default.nixes

This commit is contained in:
Shea Levy 2017-06-10 20:04:46 -04:00
parent 219bb1c80c
commit 01e047d088
2 changed files with 21 additions and 6 deletions

View file

@ -12,17 +12,19 @@ let
haskellPackages = makePackageSet {
package-set = initialPackages;
inherit ghc;
inherit ghc extensible-self;
};
commonConfiguration = import ./configuration-common.nix { inherit pkgs; };
nixConfiguration = import ./configuration-nix.nix { inherit pkgs; };
in
makeExtensible
extensible-self = makeExtensible
(extends overrides
(extends packageSetConfig
(extends compilerConfig
(extends commonConfiguration
(extends nixConfiguration haskellPackages)))))
(extends nixConfiguration haskellPackages)))));
in
extensible-self

View file

@ -7,7 +7,8 @@
# arguments:
# * ghc package to use
# * package-set: a function that takes { pkgs, stdenv, callPackage } as first arg and `self` as second
{ ghc, package-set }:
# * extensible-self: the final, fully overriden package set usable with the nixpkgs fixpoint overriding functionality
{ ghc, package-set, extensible-self }:
# return value: a function from self to the package set
self: let
@ -128,6 +129,18 @@ in package-set { inherit pkgs stdenv callPackage; } self // {
else self.callHackage;
in generateExprs name src {}) overrides;
# : { root : Path, source-overrides : Defaulted (Either Path VersionNumber } -> NixShellAwareDerivation
# Given a path to a haskell package directory whose cabal file is
# named the same as the directory name, and an optional set of
# source overrides as appropriate for the 'packageSourceOverrides'
# function, return a derivation appropriate for nix-build or nix-shell
# to build that package.
developPackage = { root, source-overrides ? {} }:
let name = builtins.baseNameOf root;
drv =
(extensible-self.extend (self.packageSourceOverrides source-overrides)).callCabal2nix name root {};
in if pkgs.lib.inNixShell then drv.env else drv;
ghcWithPackages = selectFrom: withPackages (selectFrom self);
ghcWithHoogle = selectFrom: