nixos/nixos-*: use runtimeShell

Fix shebangs and other shell uses in the NixOS tools, allowing them to work
correctly on cross-compiled systems.
This commit is contained in:
Ben Wolsieffer 2020-08-13 15:54:51 -04:00 committed by Alyssa Ross
parent dda939844a
commit 23b4356a5f
6 changed files with 11 additions and 6 deletions

View file

@ -1,4 +1,4 @@
#! @shell@ -e #! @runtimeShell@ -e
# Shows the usage of this command to the user # Shows the usage of this command to the user

View file

@ -1,4 +1,4 @@
#! @shell@ #! @runtimeShell@
set -e set -e

View file

@ -1,4 +1,4 @@
#! @shell@ #! @runtimeShell@
set -e set -e
shopt -s nullglob shopt -s nullglob

View file

@ -1,6 +1,6 @@
#! @shell@ #! @runtimeShell@
if [ -x "@shell@" ]; then export SHELL="@shell@"; fi; if [ -x "@runtimeShell@" ]; then export SHELL="@runtimeShell@"; fi;
set -e set -e
set -o pipefail set -o pipefail

View file

@ -1,4 +1,4 @@
#! @shell@ #! @runtimeShell@
case "$1" in case "$1" in
-h|--help) -h|--help)

View file

@ -14,11 +14,13 @@ let
nixos-build-vms = makeProg { nixos-build-vms = makeProg {
name = "nixos-build-vms"; name = "nixos-build-vms";
src = ./nixos-build-vms/nixos-build-vms.sh; src = ./nixos-build-vms/nixos-build-vms.sh;
inherit (pkgs) runtimeShell;
}; };
nixos-install = makeProg { nixos-install = makeProg {
name = "nixos-install"; name = "nixos-install";
src = ./nixos-install.sh; src = ./nixos-install.sh;
inherit (pkgs) runtimeShell;
nix = config.nix.package.out; nix = config.nix.package.out;
path = makeBinPath [ nixos-enter ]; path = makeBinPath [ nixos-enter ];
}; };
@ -28,6 +30,7 @@ let
makeProg { makeProg {
name = "nixos-rebuild"; name = "nixos-rebuild";
src = ./nixos-rebuild.sh; src = ./nixos-rebuild.sh;
inherit (pkgs) runtimeShell;
nix = config.nix.package.out; nix = config.nix.package.out;
nix_x86_64_linux = fallback.x86_64-linux; nix_x86_64_linux = fallback.x86_64-linux;
nix_i686_linux = fallback.i686-linux; nix_i686_linux = fallback.i686-linux;
@ -50,6 +53,7 @@ let
nixos-version = makeProg { nixos-version = makeProg {
name = "nixos-version"; name = "nixos-version";
src = ./nixos-version.sh; src = ./nixos-version.sh;
inherit (pkgs) runtimeShell;
inherit (config.system.nixos) version codeName revision; inherit (config.system.nixos) version codeName revision;
inherit (config.system) configurationRevision; inherit (config.system) configurationRevision;
json = builtins.toJSON ({ json = builtins.toJSON ({
@ -64,6 +68,7 @@ let
nixos-enter = makeProg { nixos-enter = makeProg {
name = "nixos-enter"; name = "nixos-enter";
src = ./nixos-enter.sh; src = ./nixos-enter.sh;
inherit (pkgs) runtimeShell;
}; };
in in