haskell-generic-builder: add an 'env' attribute to every Haskell expression that can be used with nix-shell to create an interactive build environment for this package
For example: nix-shell --pure ~/.nix-defexpr -A haskell-ng.packages.ghc784.hsdns.env
This commit is contained in:
parent
f36973ce83
commit
89b5d9ee14
@ -69,6 +69,17 @@ let
|
|||||||
sha256 = editedCabalFile;
|
sha256 = editedCabalFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
isHaskellPkg = x: (x ? pname) && (x ? version);
|
||||||
|
isSystemPkg = x: !isHaskellPkg x;
|
||||||
|
|
||||||
|
allBuildInputs = stdenv.lib.filter (x: x != null) (
|
||||||
|
buildDepends ++ extraLibraries ++ buildTools ++
|
||||||
|
optionals (pkgconfigDepends != []) ([pkgconfig] ++ pkgconfigDepends) ++
|
||||||
|
optionals doCheck testDepends
|
||||||
|
);
|
||||||
|
haskellBuildInputs = stdenv.lib.filter isHaskellPkg allBuildInputs;
|
||||||
|
systemBuildInputs = stdenv.lib.filter isSystemPkg allBuildInputs;
|
||||||
|
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation ({
|
stdenv.mkDerivation ({
|
||||||
name = "${optionalString hasActiveLibrary "haskell-"}${pname}-${version}";
|
name = "${optionalString hasActiveLibrary "haskell-"}${pname}-${version}";
|
||||||
@ -195,7 +206,17 @@ stdenv.mkDerivation ({
|
|||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
passthru = passthru // { inherit pname version; };
|
passthru = passthru // {
|
||||||
|
|
||||||
|
inherit pname version;
|
||||||
|
|
||||||
|
env = stdenv.mkDerivation {
|
||||||
|
name = "interactive-${optionalString hasActiveLibrary "haskell-"}${pname}-${version}-environment";
|
||||||
|
nativeBuildInputs = [ (ghc.withPackages (p: haskellBuildInputs)) systemBuildInputs ];
|
||||||
|
shellHook = "eval $(grep export $(type -p ghc))";
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
meta = { inherit homepage license platforms hydraPlatforms; }
|
meta = { inherit homepage license platforms hydraPlatforms; }
|
||||||
// optionalAttrs broken { inherit broken; }
|
// optionalAttrs broken { inherit broken; }
|
||||||
|
Loading…
Reference in New Issue
Block a user