diff --git a/modules/installer/tools/nixos-install.sh b/modules/installer/tools/nixos-install.sh index 5b7746b6162..e55955db7c4 100644 --- a/modules/installer/tools/nixos-install.sh +++ b/modules/installer/tools/nixos-install.sh @@ -6,7 +6,7 @@ # - register validity # - with a chroot to the target device: # * do a nix-pull -# * nix-env -p /nix/var/nix/profiles/system -i +# * nix-env -p @stateDir@/nix/profiles/system -i # * run the activation script of the configuration (also installs Grub) set -e @@ -92,16 +92,16 @@ mkdir -m 0755 -p $mountPoint/var # Create the necessary Nix directories on the target device, if they # don't already exist. mkdir -m 0755 -p \ - $mountPoint/nix/var/nix/gcroots \ - $mountPoint/nix/var/nix/temproots \ - $mountPoint/nix/var/nix/manifests \ - $mountPoint/nix/var/nix/userpool \ - $mountPoint/nix/var/nix/profiles \ - $mountPoint/nix/var/nix/db \ - $mountPoint/nix/var/log/nix/drvs + $mountPoint@stateDir@/nix/gcroots \ + $mountPoint@stateDir@/nix/temproots \ + $mountPoint@stateDir@/nix/manifests \ + $mountPoint@stateDir@/nix/userpool \ + $mountPoint@stateDir@/nix/profiles \ + $mountPoint@stateDir@/nix/db \ + $mountPoint@stateDir@/log/nix/drvs mkdir -m 1777 -p \ - $mountPoint/nix/store \ + $mountPoint@storeDir@ \ # Get the store paths to copy from the references graph. @@ -112,7 +112,7 @@ storePaths=$(@perl@/bin/perl @pathsFromGraph@ @nixClosure@) echo "copying Nix to $mountPoint...." for i in $storePaths; do echo " $i" - rsync -a $i $mountPoint/nix/store/ + rsync -a $i $mountPoint@storeDir@/ done @@ -154,7 +154,7 @@ fi # it into the system configuration profile. echo "building the system configuration..." NIXPKGS=/mnt/etc/nixos/nixpkgs chroot $mountPoint @nix@/bin/nix-env \ - -p /nix/var/nix/profiles/system \ + -p @stateDir@/nix/profiles/system \ -f "/mnt$NIXOS" \ --set -A system @@ -196,4 +196,4 @@ touch $mountPoint/etc/NIXOS # configuration. echo "finalising the installation..." NIXOS_INSTALL_GRUB=1 chroot $mountPoint \ - /nix/var/nix/profiles/system/bin/switch-to-configuration boot + @stateDir@/nix/profiles/system/bin/switch-to-configuration boot diff --git a/modules/installer/tools/nixos-rebuild.sh b/modules/installer/tools/nixos-rebuild.sh index 90df386faa9..4da87c5f9b1 100644 --- a/modules/installer/tools/nixos-rebuild.sh +++ b/modules/installer/tools/nixos-rebuild.sh @@ -133,9 +133,9 @@ if test -n "$pullManifest"; then manifests=$(nix-instantiate --eval-only --xml --strict $NIXOS -A manifests \ | grep '&2 if test "$action" = switch -o "$action" = boot; then - nix-env -p /nix/var/nix/profiles/system -f $NIXOS --set -A system $extraBuildFlags - pathToConfig=/nix/var/nix/profiles/system + nix-env -p @stateDir@/nix/profiles/system -f $NIXOS --set -A system $extraBuildFlags + pathToConfig=@stateDir@/nix/profiles/system elif test "$action" = test -o "$action" = build -o "$action" = dry-run; then nix-build $NIXOS -A system -K -k $extraBuildFlags > /dev/null pathToConfig=./result @@ -178,14 +178,14 @@ if test -z "$rollback"; then fi else # test -n "$rollback" if test "$action" = switch -o "$action" = boot; then - nix-env --rollback -p /nix/var/nix/profiles/system - pathToConfig=/nix/var/nix/profiles/system + nix-env --rollback -p @stateDir@/nix/profiles/system + pathToConfig=@stateDir@/nix/profiles/system elif test "$action" = test -o "$action" = build; then systemNumber=$( - nix-env -p /nix/var/nix/profiles/system --list-generations | + nix-env -p @stateDir@/nix/profiles/system --list-generations | sed -n '/current/ {g; p;}; s/ *\([0-9]*\).*/\1/; h' ) - ln -sT /nix/var/nix/profiles/system-${systemNumber}-link ./result + ln -sT @stateDir@/nix/profiles/system-${systemNumber}-link ./result pathToConfig=./result else showSyntax