Skip to content

Commit

Permalink
nix-shell: Don't add root for shell with --out-link.
Browse files Browse the repository at this point in the history
It is an input of the shell itself.
  • Loading branch information
jsoo1 committed Nov 1, 2022
1 parent 9aff695 commit 7a37384
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions src/nix-build/nix-build.cc
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,7 @@ static void main_nix_build(int argc, char * * argv)

if (shellDrv) {
auto shellDrvOutputs = store->queryPartialDerivationOutputMap(shellDrv.value());
auto shellDrvOut = shellDrvOutputs.at("out").value();
shell = store->printStorePath(shellDrvOut) + "/bin/bash";

if (outLink) writeOutLink(*outLink + "-shell", shellDrvOut, "out");
shell = store->printStorePath(shellDrvOutputs.at("out").value()) + "/bin/bash";
}

if (settings.isExperimentalFeatureEnabled(Xp::CaDerivations)) {
Expand Down
4 changes: 2 additions & 2 deletions tests/nix-shell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ output=$($TEST_ROOT/spaced\ \\\'\"shell.shebang.rb abc ruby)

# Test nix-shell --out-link -p creates gcroot
nix-shell --pure -p foo --out-link $TEST_ROOT/gcroots/foo-root
[ -L $TEST_ROOT/gcroots/foo-root ] && [ -L $TEST_ROOT/gcroots/foo-root-shell ]
[ -L $TEST_ROOT/gcroots/foo-root ]

# Test nix-shell --out-link -A creates gcroot
nix-shell --pure -A foo --out-link $TEST_ROOT/gcroots/foo-attr-root
[ -L $TEST_ROOT/gcroots/foo-attr-root ] && [ -L $TEST_ROOT/gcroots/foo-attr-root-shell ]
[ -L $TEST_ROOT/gcroots/foo-attr-root ]

# Test 'nix develop'.
nix develop -f "$shellDotNix" shellDrv -c bash -c '[[ -n $stdenv ]]'
Expand Down

0 comments on commit 7a37384

Please sign in to comment.