91dc023665
Whenever Nix attempts to realise a derivation for which a closure is already known, but this closure cannot be realised, fall back on normalising the derivation. The most common scenario in which this is useful is when we have registered substitutes in order to perform binary distribution from, say, a network repository. If the repository is down, the realisation of the derivation will fail. When this option is specified, Nix will build the derivation instead. Thus, binary installation falls back on a source installation. This option is not the default since it is generally not desirable for a transient failure in obtaining the substitutes to lead to a full build from source (with the related consumption of resources).
15 lines
614 B
Bash
15 lines
614 B
Bash
storeExpr=$($TOP/src/nix-instantiate/nix-instantiate fall-back.nix)
|
|
|
|
echo "store expr is $storeExpr"
|
|
|
|
# Register a non-existant successor (and a nox-existant substitute).
|
|
suc=$NIX_STORE_DIR/deadbeafdeadbeafdeadbeafdeadbeaf-s.store
|
|
(echo $suc && echo $NIX_STORE_DIR/ffffffffffffffffffffffffffffffff.store && echo "/bla" && echo 0) | $TOP/src/nix-store/nix-store --substitute
|
|
$TOP/src/nix-store/nix-store --successor $storeExpr $suc
|
|
|
|
outPath=$($TOP/src/nix-store/nix-store -qnf --fallback "$storeExpr")
|
|
|
|
echo "output path is $outPath"
|
|
|
|
text=$(cat "$outPath"/hello)
|
|
if test "$text" != "Hello World!"; then exit 1; fi
|