summaryrefslogtreecommitdiffstats
path: root/pkgs/os-specific
diff options
context:
space:
mode:
authorTimothy DeHerrera <tim.deh@pm.me>2021-09-09 13:53:37 -0600
committerGitHub <noreply@github.com>2021-09-09 13:53:37 -0600
commit6dbeb3190d26a7f64c2109ba915ceb7c3dbba91d (patch)
treed9b879cd9db8e98fcf440f03ae94f426d3d3dae9 /pkgs/os-specific
parent60c852813a346767d0a582224c1d2f5d1e844c5f (diff)
parentbf185eaa6935c4ab58f079a7a5c3e09ce5a123f9 (diff)
Merge pull request #126544 from jonringer/nixos-rebuild-use-substitutes
nixos-rebuild: add --use-substitutes option
Diffstat (limited to 'pkgs/os-specific')
-rwxr-xr-xpkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh12
1 files changed, 8 insertions, 4 deletions
diff --git a/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh b/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh
index b58c3b60bf9a..198a6eae6005 100755
--- a/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh
+++ b/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh
@@ -16,6 +16,7 @@ showSyntax() {
# Parse the command line.
origArgs=("$@")
+copyClosureFlags=()
extraBuildFlags=()
lockFlags=()
flakeFlags=()
@@ -60,6 +61,9 @@ while [ "$#" -gt 0 ]; do
upgrade=1
upgrade_all=1
;;
+ -s|--use-substitutes)
+ copyClosureFlags+=("$i")
+ ;;
--max-jobs|-j|--cores|-I|--builders)
j="$1"; shift 1
extraBuildFlags+=("$i" "$j")
@@ -157,11 +161,11 @@ targetHostCmd() {
copyToTarget() {
if ! [ "$targetHost" = "$buildHost" ]; then
if [ -z "$targetHost" ]; then
- NIX_SSHOPTS=$SSHOPTS nix-copy-closure --from "$buildHost" "$1"
+ NIX_SSHOPTS=$SSHOPTS nix-copy-closure "${copyClosureFlags[@]}" --from "$buildHost" "$1"
elif [ -z "$buildHost" ]; then
- NIX_SSHOPTS=$SSHOPTS nix-copy-closure --to "$targetHost" "$1"
+ NIX_SSHOPTS=$SSHOPTS nix-copy-closure "${copyClosureFlags[@]}" --to "$targetHost" "$1"
else
- buildHostCmd nix-copy-closure --to "$targetHost" "$1"
+ buildHostCmd nix-copy-closure "${copyClosureFlags[@]}" --to "$targetHost" "$1"
fi
fi
}
@@ -425,7 +429,7 @@ if [[ -n $buildNix && -z $flake ]]; then
if [ -a "$nixDrv" ]; then
nix-store -r "$nixDrv"'!'"out" --add-root "$tmpDir/nix" --indirect >/dev/null
if [ -n "$buildHost" ]; then
- nix-copy-closure --to "$buildHost" "$nixDrv"
+ nix-copy-closure "${copyClosureFlags[@]}" --to "$buildHost" "$nixDrv"
# The nix build produces multiple outputs, we add them all to the remote path
for p in $(buildHostCmd nix-store -r "$(readlink "$nixDrv")" "${buildArgs[@]}"); do
remoteNix="$remoteNix${remoteNix:+:}$p/bin"