summary refs log tree commit diff
path: root/pkgs/os-specific/linux
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-07-28 17:06:03 +0200
committerEelco Dolstra <edolstra@gmail.com>2021-07-28 17:13:01 +0200
commit0ad27c8653daaf59cf0fb2e0b30561a8d86303fa (patch)
tree68645750199334da4b4fef9a9c637f6f9e6ebca2 /pkgs/os-specific/linux
parent65584b6a0bbc82df63789b48570bb9e84d58dd29 (diff)
downloadnixpkgs-0ad27c8653daaf59cf0fb2e0b30561a8d86303fa.tar
nixpkgs-0ad27c8653daaf59cf0fb2e0b30561a8d86303fa.tar.gz
nixpkgs-0ad27c8653daaf59cf0fb2e0b30561a8d86303fa.tar.bz2
nixpkgs-0ad27c8653daaf59cf0fb2e0b30561a8d86303fa.tar.lz
nixpkgs-0ad27c8653daaf59cf0fb2e0b30561a8d86303fa.tar.xz
nixpkgs-0ad27c8653daaf59cf0fb2e0b30561a8d86303fa.tar.zst
nixpkgs-0ad27c8653daaf59cf0fb2e0b30561a8d86303fa.zip
nixos-rebuild: Set inherit_errexit
Without this, failure of nixBuild() and nixFlakeBuild() was ignored
(since bash doesn't inherit 'set -e' in subshells by default), so the
script would proceed with a bogus ./result link, e.g.

  ++ readlink -f /tmp/nixos-rebuild.NfHKxx/result
  + pathToConfig='/nix/store/m7dvk6an18cpr95qn5wnig2600qhv6w7-nix-2.4pre20210727_706777a/bin/nix
  /tmp/nixos-rebuild.NfHKxx/result'
  + '[' test = switch -o test = boot ']'
  + copyToTarget '/nix/store/m7dvk6an18cpr95qn5wnig2600qhv6w7-nix-2.4pre20210727_706777a/bin/nix
  /tmp/nixos-rebuild.NfHKxx/result'
  + '[' '' = '' ']'
  + '[' test = switch -o test = boot -o test = test -o test = dry-activate ']'
  + targetHostCmd /nix/store/m7dvk6an18cpr95qn5wnig2600qhv6w7-nix-2.4pre20210727_706777a/bin/nix /tmp/nixos-rebuild.NfHKxx/result/bin/switch-to-configuration test
  + '[' -z '' ']'
  + sudo -- /nix/store/m7dvk6an18cpr95qn5wnig2600qhv6w7-nix-2.4pre20210727_706777a/bin/nix /tmp/nixos-rebuild.NfHKxx/result/bin/switch-to-configuration test
  error: '/tmp/nixos-rebuild.NfHKxx/result/bin/switch-to-configuration' is not a recognised command
  Try '/nix/store/m7dvk6an18cpr95qn5wnig2600qhv6w7-nix-2.4pre20210727_706777a/bin/nix --help' for more information.
  + echo 'warning: error(s) occurred while switching to the new configuration'
  warning: error(s) occurred while switching to the new configuration
Diffstat (limited to 'pkgs/os-specific/linux')
-rwxr-xr-xpkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh1
1 files changed, 1 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh b/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh
index 69e0dee1d20..6d082cb100e 100755
--- a/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh
+++ b/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh
@@ -4,6 +4,7 @@ if [ -x "@runtimeShell@" ]; then export SHELL="@runtimeShell@"; fi;
 
 set -e
 set -o pipefail
+shopt -s inherit_errexit
 
 export PATH=@path@:$PATH