aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorregnat <rg@regnat.ovh>2020-12-10 17:40:00 +0100
committerregnat <rg@regnat.ovh>2020-12-11 10:28:09 +0100
commiteb453081092cbee5f8176c1d348ac23e46a24281 (patch)
treec506f6a22df21ab83387062826a6e557331a7fbd
parent253571e4ecc990c7f63ed8d70dbee9e4cec8002c (diff)
Fix the `nix` command with CA derivations
Prevents a crash because most `nix` subcommands assumed that derivations know their output path, which isn't the case for CA derivations
-rw-r--r--src/nix/installables.cc2
-rw-r--r--tests/content-addressed.sh6
2 files changed, 7 insertions, 1 deletions
diff --git a/src/nix/installables.cc b/src/nix/installables.cc
index b6ed030af..3506c3fcc 100644
--- a/src/nix/installables.cc
+++ b/src/nix/installables.cc
@@ -409,7 +409,7 @@ std::vector<InstallableValue::DerivationInfo> InstallableAttrPath::toDerivations
for (auto & drvInfo : drvInfos) {
res.push_back({
state->store->parseStorePath(drvInfo.queryDrvPath()),
- state->store->parseStorePath(drvInfo.queryOutPath()),
+ state->store->maybeParseStorePath(drvInfo.queryOutPath()),
drvInfo.queryOutputName()
});
}
diff --git a/tests/content-addressed.sh b/tests/content-addressed.sh
index 03eff549c..bc37a99c1 100644
--- a/tests/content-addressed.sh
+++ b/tests/content-addressed.sh
@@ -50,7 +50,13 @@ testGC () {
nix-collect-garbage --experimental-features ca-derivations --option keep-derivations true
}
+testNixCommand () {
+ clearStore
+ nix build --experimental-features 'nix-command ca-derivations' --file ./content-addressed.nix --no-link
+}
+
testRemoteCache
testDeterministicCA
testCutoff
testGC
+testNixCommand