Impossible to log in to result of nixos-rebuild build-vm

Declaratively …

… at least, I was under the impression that I was setting it declaratively … [I try to do everything declaratively, that’s pretty much the point of Nix AFAIAC: I’ve wasted too much time and energy in my life on hidden state screwing things up] …

… but it turns out I had switched it to imperative in some explorative hacking session, and hadn’t set it back.

So I switched it back to declarative. Still didn’t work. I even resorted to password = "aaa" to make absolutely sure that I can’t mistype it, even with my Dvorak keyboard (a is in the same place on Dvorak and Qwerty) and it still didn’t work.

Eventually, I came across the following in the manual:

Important: delete the $hostname.qcow2 file if you have started the virtual machine at least once without the right users, otherwise the changes will not get picked up.

When I removed this file, I could log in to the VM.

So … it was piece of implicit mutable state outside of my declarative Nix configuration which was screwing it up! AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARRRRRRGHHHHHHH! This is soul-crushing.

When I recover the desire to live, the next hurdle will be to get the VM to pick up my user settings, so that I can actually start debugging and fixing them. I have these defined declaratively via home-manager … but the manual states that

The VM does not have any data from your host system, so your existing user accounts and home directories will not be available unless you have set mutableUsers = false.

I have mutableUsers = false … and yet my home directory on the VM remains empty.

Any suggestions?

3 Likes