From e40bfa4d850ed5973bdfd965fc331feb545a5e76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 11 Jan 2019 10:39:26 +0000 Subject: [PATCH] nixos-rebuild: allow to override builders Since nix 2.0 the no-build-hook option was replaced by the builders options that allows to override remote builders ad-hoc. Since it is useful to disable remote builders updating nixos without network, this commit reintroduces the option. --- nixos/doc/manual/man-nixos-rebuild.xml | 53 ++++++++++++++----- .../modules/installer/tools/nixos-rebuild.sh | 4 +- 2 files changed, 41 insertions(+), 16 deletions(-) diff --git a/nixos/doc/manual/man-nixos-rebuild.xml b/nixos/doc/manual/man-nixos-rebuild.xml index 551a65f5e96b..5e66946aa5be 100644 --- a/nixos/doc/manual/man-nixos-rebuild.xml +++ b/nixos/doc/manual/man-nixos-rebuild.xml @@ -13,35 +13,35 @@ - nixos-rebuild + nixos-rebuild - + - + - + - + - + - + - + @@ -50,29 +50,33 @@ - + - + - + - + + + + builder-spec + - + - + @@ -315,6 +319,27 @@ $ ./result/bin/run-*-vm + + + + builder-spec + + + + Allow to specify remote builders ad-hoc for building the new system. + This requires the user executing nixos-rebuild (usually + root) to be configured as a trusted user in the Nix daemon. This can be + achived by using the nix.trustedUsers NixOS option. + Examples values for that option are described in the + Remote builds chapter in the Nix manual, + (i.e. --builders "ssh://bigbrother x86_64-linux"). + By specifying an empty string existing builders specified in + /etc/nix/machines can be ignored: + --builders "" for example when they are not + reachable due to network connectivity. + + + diff --git a/nixos/modules/installer/tools/nixos-rebuild.sh b/nixos/modules/installer/tools/nixos-rebuild.sh index 2af73519bc52..361c2e49e05c 100644 --- a/nixos/modules/installer/tools/nixos-rebuild.sh +++ b/nixos/modules/installer/tools/nixos-rebuild.sh @@ -53,11 +53,11 @@ while [ "$#" -gt 0 ]; do repair=1 extraBuildFlags+=("$i") ;; - --max-jobs|-j|--cores|-I) + --max-jobs|-j|--cores|-I|--builders) j="$1"; shift 1 extraBuildFlags+=("$i" "$j") ;; - --show-trace|--no-build-hook|--keep-failed|-K|--keep-going|-k|--verbose|-v|-vv|-vvv|-vvvv|-vvvvv|--fallback|--repair|--no-build-output|-Q|-j*) + --show-trace|--keep-failed|-K|--keep-going|-k|--verbose|-v|-vv|-vvv|-vvvv|-vvvvv|--fallback|--repair|--no-build-output|-Q|-j*) extraBuildFlags+=("$i") ;; --option)