I’ve been struggling now for a while to get nixos-anywhere to run an installation in such a way that the resulting system is bootable.
For reference, my configuration can be found here.
First issue was that it rebooted despite not being successful when setting the boot partition. My fault, but annoying. Next issue I faced was that the swapfile wasn’t created automatically (not sure why, but the systemd unit hung forever), which I bypassed with swapDevices = pkgs.lib.mkForce [ ];
.
Then I found that even a successful installation will not allow you to set a root password like nixos-install
usually would. Now I tried running the installation like this:
$ nix run github:nix-community/nixos-anywhere -- --build-on-remote --no-reboot --flake path:$PWD#junction root@nixos
Which gets me stuck again. I can log in with ssh root@nixos
afterwards, but all the drives have been unmounted already. No worries, I do a quick mount /dev/sdf2 /mnt
. But now:
$ passwd --root /mnt felix
passwd: pam_start() failed, error 26
I feel like I’m seriously holding it wrong. This shouldn’t be so difficult, and many people are using nixos-anywhere to great effect for fully automated installs, so it’s definitely possible somehow.
Am I supposed to set the root password in some other way? Is there some hidden way that allows me to add additional ssh command during the installation process maybe?