mirror of
https://github.com/NixOS/nix.git
synced 2024-11-22 06:42:28 +00:00
Fix nix repl
’s building of CA derivations
When running a `:b` command in the repl, after building the derivations query the store for its outputs rather than just assuming that they are known in the derivation itself (which isn’t true for CA derivations) Fix #5328
This commit is contained in:
parent
886ad0055f
commit
1a4c9ba50b
@ -504,8 +504,8 @@ bool NixRepl::processLine(string line)
|
||||
state->store->buildPaths({DerivedPath::Built{drvPath}});
|
||||
auto drv = state->store->readDerivation(drvPath);
|
||||
logger->cout("\nThis derivation produced the following outputs:");
|
||||
for (auto & i : drv.outputsAndOptPaths(*state->store))
|
||||
logger->cout(" %s -> %s", i.first, state->store->printStorePath(*i.second.second));
|
||||
for (auto & [outputName, outputPath] : state->store->queryDerivationOutputMap(drvPath))
|
||||
logger->cout(" %s -> %s", outputName, state->store->printStorePath(outputPath));
|
||||
} else if (command == ":i") {
|
||||
runNix("nix-env", {"-i", drvPathRaw});
|
||||
} else {
|
||||
|
5
tests/ca/repl.sh
Normal file
5
tests/ca/repl.sh
Normal file
@ -0,0 +1,5 @@
|
||||
source common.sh
|
||||
|
||||
export NIX_TESTS_CA_BY_DEFAULT=1
|
||||
|
||||
cd .. && source repl.sh
|
@ -48,7 +48,7 @@ nix_tests = \
|
||||
flakes.sh \
|
||||
build.sh \
|
||||
compute-levels.sh \
|
||||
repl.sh \
|
||||
repl.sh ca/repl.sh \
|
||||
ca/build.sh \
|
||||
ca/build-with-garbage-path.sh \
|
||||
ca/duplicate-realisation-in-closure.sh \
|
||||
|
@ -7,7 +7,9 @@ simple = import ./simple.nix
|
||||
|
||||
testRepl () {
|
||||
local nixArgs=("$@")
|
||||
local outPath=$(nix repl "${nixArgs[@]}" <<< "$replCmds" |&
|
||||
local replOutput="$(nix repl "${nixArgs[@]}" <<< "$replCmds")"
|
||||
echo "$replOutput"
|
||||
local outPath=$(echo "$replOutput" |&
|
||||
grep -o -E "$NIX_STORE_DIR/\w*-simple")
|
||||
nix path-info "${nixArgs[@]}" "$outPath"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user