mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 14:06:16 +02:00
Merge pull request #10992 from hercules-ci/issue-10947-dont-cache-disallowed-ifd
Fix #10947; don't cache disallowed IFD
This commit is contained in:
commit
10c9764c27
2 changed files with 17 additions and 2 deletions
|
@ -78,7 +78,7 @@ StringMap EvalState::realiseContext(const NixStringContext & context, StorePathS
|
||||||
if (drvs.empty()) return {};
|
if (drvs.empty()) return {};
|
||||||
|
|
||||||
if (isIFD && !settings.enableImportFromDerivation)
|
if (isIFD && !settings.enableImportFromDerivation)
|
||||||
error<EvalError>(
|
error<EvalBaseError>(
|
||||||
"cannot build '%1%' during evaluation because the option 'allow-import-from-derivation' is disabled",
|
"cannot build '%1%' during evaluation because the option 'allow-import-from-derivation' is disabled",
|
||||||
drvs.begin()->to_string(*store)
|
drvs.begin()->to_string(*store)
|
||||||
).debugThrow();
|
).debugThrow();
|
||||||
|
|
|
@ -7,12 +7,22 @@ requireGit
|
||||||
flake1Dir="$TEST_ROOT/eval-cache-flake"
|
flake1Dir="$TEST_ROOT/eval-cache-flake"
|
||||||
|
|
||||||
createGitRepo "$flake1Dir" ""
|
createGitRepo "$flake1Dir" ""
|
||||||
|
cp ../simple.nix ../simple.builder.sh ../config.nix "$flake1Dir/"
|
||||||
|
git -C "$flake1Dir" add simple.nix simple.builder.sh config.nix
|
||||||
|
git -C "$flake1Dir" commit -m "config.nix"
|
||||||
|
|
||||||
cat >"$flake1Dir/flake.nix" <<EOF
|
cat >"$flake1Dir/flake.nix" <<EOF
|
||||||
{
|
{
|
||||||
description = "Fnord";
|
description = "Fnord";
|
||||||
outputs = { self }: {
|
outputs = { self }: let inherit (import ./config.nix) mkDerivation; in {
|
||||||
foo.bar = throw "breaks";
|
foo.bar = throw "breaks";
|
||||||
|
drv = mkDerivation {
|
||||||
|
name = "build";
|
||||||
|
buildCommand = ''
|
||||||
|
echo true > \$out
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
ifd = assert (import self.drv); self.drv;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
@ -22,3 +32,8 @@ git -C "$flake1Dir" commit -m "Init"
|
||||||
|
|
||||||
expect 1 nix build "$flake1Dir#foo.bar" 2>&1 | grepQuiet 'error: breaks'
|
expect 1 nix build "$flake1Dir#foo.bar" 2>&1 | grepQuiet 'error: breaks'
|
||||||
expect 1 nix build "$flake1Dir#foo.bar" 2>&1 | grepQuiet 'error: breaks'
|
expect 1 nix build "$flake1Dir#foo.bar" 2>&1 | grepQuiet 'error: breaks'
|
||||||
|
|
||||||
|
# Conditional error should not be cached
|
||||||
|
expect 1 nix build "$flake1Dir#ifd" --option allow-import-from-derivation false 2>&1 \
|
||||||
|
| grepQuiet 'error: cannot build .* during evaluation because the option '\''allow-import-from-derivation'\'' is disabled'
|
||||||
|
nix build "$flake1Dir#ifd"
|
||||||
|
|
Loading…
Reference in a new issue