blob: 1aa039ac2ffcc2bb8e3faad81bae8a7b2c8e1bbf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
source common.sh
# Ensures that nix build will deliver a usable error message when it encounters
# a build failure potentially caused by allowSubstitutes.
clearStore
cd $TEST_HOME
putDrv() {
cat > "$1" <<EOF
builtins.derivation {
name = "meow";
builder = "/bin/sh";
args = [];
system = "unicornsandrainbows-linux";
allowSubstitutes = ${2};
preferLocalBuild = true;
}
EOF
}
putDrv drv-disallow-substitutes.nix false
putDrv drv-allow-substitutes.nix true
expect 1 nix build --substitute --substituters '' --offline -f drv-disallow-substitutes.nix 2> output.txt
# error: a 'unicornsandrainbows-linux' with features {} is required to build '$TMPDIR/regression-484/store/...-meow.drv', but I am a 'x86_64-linux' with features {benchmark, big-parallel, kvm, nixos-test, uid-range}
#
# Hint: the failing derivation has allowSubstitutes set to false, forcing it to be built rather than substituted.
# Passing --always-allow-substitutes to force substitution may resolve this failure if the path is available in a substituter.
cat output.txt
grepQuiet unicornsandrainbows-linux output.txt
grepQuiet always-allow-substitutes output.txt
grepQuiet allowSubstitutes output.txt
expect 1 nix build --substitute --substituters '' --offline -f drv-allow-substitutes.nix 2> output.txt
cat output.txt
grepQuiet unicornsandrainbows-linux output.txt
grepQuiet -v allowSubstitutes output.txt
|