mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 04:43:09 +03:00
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.
This commit is contained in:
parent
69116f8fc9
commit
7b37a5f168
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user