Skip to content

Commit 1704cac

Browse files
committed
shellFor: Allow all mkDerivation arguments (e.g. buildInputs)
1 parent 72bd550 commit 1704cac

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

builder/shell-for.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{ lib, stdenv, glibcLocales, ghcForComponent, makeConfigFiles, hsPkgs }:
22

3-
{ packages, buildInputs ? [], withHoogle ? true } @ args:
3+
{ packages, withHoogle ? true, ... } @ args:
44

55
let
66
selected = packages hsPkgs;
@@ -30,7 +30,7 @@ in
3030
stdenv.mkDerivation (mkDrvArgs // {
3131
name = mkDrvArgs.name or name;
3232

33-
buildInputs = buildInputs ++ systemInputs ++ mkDrvArgs.buildInputs or [];
33+
buildInputs = systemInputs ++ mkDrvArgs.buildInputs or [];
3434
nativeBuildInputs = [ ghcEnv ] ++ nativeBuildInputs ++ mkDrvArgs.nativeBuildInputs or [];
3535
phases = ["installPhase"];
3636
installPhase = "echo $nativeBuildInputs $buildInputs > $out";

test/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ in {
1515
with-packages = haskell.callPackage ./with-packages { inherit util; };
1616
builder-haddock = haskell.callPackage ./builder-haddock {};
1717
stack-simple = haskell.callPackage ./stack-simple {};
18-
shell-for = haskell.callPackage ./shell-for { inherit util; };
18+
shell-for = haskell.callPackage ./shell-for {};
1919
callStackToNix = haskell.callPackage ./callStackToNix {};
2020
callCabalProjectToNix = haskell.callPackage ./call-cabal-project-to-nix {};
2121

test/shell-for/default.nix

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
{ stdenv, util, mkStackSnapshotPkgSet }:
1+
{ stdenv, cabal-install, mkStackSnapshotPkgSet }:
22

33
with stdenv.lib;
4-
with util;
54

65
let
76
pkgSet = mkStackSnapshotPkgSet {
@@ -20,6 +19,9 @@ let
2019
env = pkgSet.config.hsPkgs.shellFor {
2120
packages = ps: with ps; [ conduit conduit-extra resourcet ];
2221
withHoogle = true;
22+
# This adds cabal-install to the shell, which helps tests because
23+
# they use a nix-shell --pure. Normally you would BYO cabal-install.
24+
buildInputs = [ cabal-install ];
2325
};
2426

2527
in
@@ -40,9 +42,7 @@ in
4042
passthru = {
4143
# Used for debugging with nix repl
4244
inherit pkgSet;
43-
4445
# Used for testing externally with nix-shell (../tests.sh).
45-
# This just adds cabal-install to the existing shell.
46-
env = addCabalInstall env;
46+
inherit env;
4747
};
4848
}

0 commit comments

Comments
 (0)