diff options
author | Alexei Robyn <shados@shados.net> | 2013-09-30 00:38:57 +1000 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-09-30 13:27:08 +0200 |
commit | 869be5611deaa5f09e67e5d2f08394361715af62 (patch) | |
tree | e1981cd749b6d1f5e45eb23513cf519abc48ae62 | |
parent | c811d79c98a5f69b0c1d50e56f4b699910fd2b26 (diff) | |
download | nixlib-869be5611deaa5f09e67e5d2f08394361715af62.tar nixlib-869be5611deaa5f09e67e5d2f08394361715af62.tar.gz nixlib-869be5611deaa5f09e67e5d2f08394361715af62.tar.bz2 nixlib-869be5611deaa5f09e67e5d2f08394361715af62.tar.lz nixlib-869be5611deaa5f09e67e5d2f08394361715af62.tar.xz nixlib-869be5611deaa5f09e67e5d2f08394361715af62.tar.zst nixlib-869be5611deaa5f09e67e5d2f08394361715af62.zip |
Added support for -I flag to nixos-install
-rw-r--r-- | modules/installer/tools/nixos-install.sh | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/modules/installer/tools/nixos-install.sh b/modules/installer/tools/nixos-install.sh index b7efcd2156ce..a4ac5b68dd7f 100644 --- a/modules/installer/tools/nixos-install.sh +++ b/modules/installer/tools/nixos-install.sh @@ -8,6 +8,24 @@ # * nix-env -p /nix/var/nix/profiles/system -i <nix-expr for the configuration> # * run the activation script of the configuration (also installs Grub) +# Parse the command line for the -I flag +extraBuildFlags=() + +while [ "$#" -gt 0 ]; do + i="$1"; shift 1 + case "$i" in + -I) + given_path="$1"; shift 1 + absolute_path=$(readlink -m $given_path) + extraBuildFlags+=("$i" "/mnt$absolute_path") + ;; + *) + echo "$0: unknown option \`$i'" + exit 1 + ;; + esac +done + set -e shopt -s nullglob @@ -179,7 +197,7 @@ mount --bind $(readlink -f $(nix-instantiate --find-file nixos)) $mountPoint/mnt echo "building the system configuration..." NIX_PATH="nixpkgs=/mnt-nixpkgs:nixos=/mnt-nixos:nixos-config=$NIXOS_CONFIG" NIXOS_CONFIG= \ chroot $mountPoint @nix@/bin/nix-env \ - -p /nix/var/nix/profiles/system -f '<nixos>' --set -A system --show-trace + "${extraBuildFlags[@]}" -p /nix/var/nix/profiles/system -f '<nixos>' --set -A system --show-trace # Copy the NixOS/Nixpkgs sources to the target as the initial contents @@ -187,11 +205,11 @@ NIX_PATH="nixpkgs=/mnt-nixpkgs:nixos=/mnt-nixos:nixos-config=$NIXOS_CONFIG" NIXO mkdir -m 0755 -p $mountPoint/nix/var/nix/profiles mkdir -m 1777 -p $mountPoint/nix/var/nix/profiles/per-user mkdir -m 0755 -p $mountPoint/nix/var/nix/profiles/per-user/root -srcs=$(nix-env -p /nix/var/nix/profiles/per-user/root/channels -q nixos --no-name --out-path 2>/dev/null || echo -n "") +srcs=$(nix-env "${extraBuildFlags[@]}" -p /nix/var/nix/profiles/per-user/root/channels -q nixos --no-name --out-path 2>/dev/null || echo -n "") if test -n "$srcs"; then echo "copying NixOS/Nixpkgs sources..." chroot $mountPoint @nix@/bin/nix-env \ - -p /nix/var/nix/profiles/per-user/root/channels -i "$srcs" --quiet + "${extraBuildFlags[@]}" -p /nix/var/nix/profiles/per-user/root/channels -i "$srcs" --quiet fi mkdir -m 0700 -p $mountPoint/root/.nix-defexpr ln -sfn /nix/var/nix/profiles/per-user/root/channels $mountPoint/root/.nix-defexpr/channels |