Skip to content

Commit

Permalink
Enable always-allow-substitutes by default
Browse files Browse the repository at this point in the history
A typical CI machine will have fast internet access, but may not have
all the inputs already in the store to rebuild trivial derivations
marked with `allowSubstitutes = false`. This leads to expensive cycles
of downloads and rebuilds for derivations like the top-level NixOS
system, which will be rebuilt from scratch on every CI run, despite
being cached.
  • Loading branch information
sandydoo committed May 14, 2024
1 parent 8887e59 commit 859c1e7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions install-nix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ fi
if [[ ! $INPUT_EXTRA_NIX_CONFIG =~ "experimental-features" ]]; then
add_config "experimental-features = nix-command flakes"
fi
# Always allow substituting from the cache, even if the derivation has `allowSubstitutes = false`.
# This is a CI optimisation to avoid having to download the inputs for already-cached derivations to rebuild trivial text files.
if [[ ! $INPUT_EXTRA_NIX_CONFIG =~ "always-allow-substitutes" ]]; then
add_config "always-allow-substitutes = true"
fi

# Nix installer flags
installer_options=(
Expand Down

0 comments on commit 859c1e7

Please sign in to comment.