basically there was a moment when I changed a user variable in my hove config without thinking, immediately regretted it and changed it back, but it didn’t help. I tried asking every AI chatbot and searched all the existing issues, but still can’t figure out how to fix it. I also tried rolling back to the previous generations, but it didn’t help either. my user is niko, w4le5 is a non-existent user that I applied by mistake.
full configwarning: the following units failed: home-manager-niko.service
× home-manager-niko.service - Home Manager environment for niko
Loaded: loaded (/etc/systemd/system/home-manager-niko.service; enabled; preset: ignored)
Active: failed (Result: exit-code) since Wed 2026-01-21 00:30:18 +05; 360ms ago
Invocation: 7f45744c29244954b53b7813b2e738f1
Process: 2939 ExecStart=/nix/store/rayqv9xw3qkwjp007p6avfwi277z9zy6-hm-setup-env /nix/store/dqk69wjxpim8dm1cn4hvb50fbzml510x-home-manager-generation (code=exited, st
Main PID: 2939 (code=exited, status=1/FAILURE)
IP: 0B in, 0B out
IO: 12K read, 0B written
Mem peak: 9M
CPU: 94ms
Jan 21 00:30:18 pwnstation systemd[1]: Starting Home Manager environment for niko...
Jan 21 00:30:18 pwnstation hm-activate-niko[2939]: Starting Home Manager activation
Jan 21 00:30:18 pwnstation hm-activate-niko[2939]: Environment variable USER is set to "w4le5" but we expect "niko"
Jan 21 00:30:18 pwnstation systemd[1]: home-manager-niko.service: Main process exited, code=exited, status=1/FAILURE
Jan 21 00:30:18 pwnstation systemd[1]: home-manager-niko.service: Failed with result 'exit-code'.
Jan 21 00:30:18 pwnstation systemd[1]: Failed to start Home Manager environment for niko.
Unfortunately it didn’t help, I have tried it already actually.
BTW: I know right? I thought it would help too, but after rolling back to the very first generation of my system i realized that it’s not the case sadly
That won’t work because this has nothing to do with rebuilding, it’s the hm activation service which has an isolated environment.
Won’t work because other stateful data has changed, like (hopefully) /etc/passwd, /etc/shadow, … and NixOS does not track stateful data (as it shouldn’t, that would imply data loss on every boot). That’s why users.mutableUsers is on by default.
Anyway:
What’s the output of the commands below?
systemctl show home-manager-niko --property=User,Environment --no-pager
whoami
Oh. Yeah that’s definitely not the way to change usernames.
I know you mentioned “rolling back” but unclear what you tried - did you try rebooting your system (into the current generation again) after removing those vars?
I have tried rebooting into the current generation and when it didn’t work I also tried rebooting into previous generation. and when it didn’t work either I just rolled back as far as possible just to make sure, but the problem persisted
Well, I attached the entire config and described how I tried to fix it myself. What else can I provide that would be helpful? If you request something specific, I’ll be happy to provide it
IMO if you did no other changes to your user, this feels like a home-manager bug, envvar changes should not be so stateful as to persist through reboot.