summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorJookia <166291@gmail.com>2015-04-28 12:16:37 +1000
committerShea Levy <shea@shealevy.com>2015-04-28 06:34:47 -0400
commit7b37a5f168706db5efa33599354f5c1967ac4c51 (patch)
tree5dca14e80df355927de8700a7ead5c64c9ae6412 /nixos
parent69116f8fc93edf64c641c4f6dd74d65c86b9bd11 (diff)
downloadnixpkgs-7b37a5f168706db5efa33599354f5c1967ac4c51.tar
nixpkgs-7b37a5f168706db5efa33599354f5c1967ac4c51.tar.gz
nixpkgs-7b37a5f168706db5efa33599354f5c1967ac4c51.tar.bz2
nixpkgs-7b37a5f168706db5efa33599354f5c1967ac4c51.tar.lz
nixpkgs-7b37a5f168706db5efa33599354f5c1967ac4c51.tar.xz
nixpkgs-7b37a5f168706db5efa33599354f5c1967ac4c51.tar.zst
nixpkgs-7b37a5f168706db5efa33599354f5c1967ac4c51.zip
nixos-install: Fix password prompt failing outside NixOS.
When bootstrapping from other distributions, nixos-install is unable to find
various tools in the chroot since their paths aren't aware of NixOS conventions.

This makes a small change to existing code by specifying nixpkgs/nixos instead
of just nixos when running nix-instantiate in the chroot. I haven't tested this
outside of bootstrapping, but the same specification is used elsewhere in the
code so I don't see why it wouldn't work.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/installer/tools/nixos-install.sh8
1 files changed, 7 insertions, 1 deletions
diff --git a/nixos/modules/installer/tools/nixos-install.sh b/nixos/modules/installer/tools/nixos-install.sh
index 14ae3daace0..86e57f704c1 100644
--- a/nixos/modules/installer/tools/nixos-install.sh
+++ b/nixos/modules/installer/tools/nixos-install.sh
@@ -254,8 +254,14 @@ NIXOS_INSTALL_GRUB=1 chroot $mountPoint \
 chroot $mountPoint /nix/var/nix/profiles/system/activate
 
 
+# Some systems may not be prepared to use NixOS' paths.
+export PATH=/run/current-system/sw/bin:/run/current-system/sw/sbin:$PATH
+export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos:nixpkgs=/etc/nixos/nixpkgs
+export NIX_PATH=$NIX_PATH:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels
+
+
 # Ask the user to set a root password.
-if [ "$(chroot $mountPoint nix-instantiate --eval '<nixos>' -A config.users.mutableUsers)" = true ] && [ -t 0 ] ; then
+if [ "$(chroot $mountPoint nix-instantiate --eval '<nixpkgs/nixos>' -A config.users.mutableUsers)" = true ] && [ -t 1 ] ; then
     echo "setting root password..."
     chroot $mountPoint /var/setuid-wrappers/passwd
 fi