Failed to move to hyprland, now my home-manager service refuses to start

I tried switching from plasma6 to hyprland. I failed and temporarily returned to the plasma to seek more help, but now my flake with home-manager seems not to start up properly. With each time I nh os switch . -u I get the following error:

> Activating configuration
activating the configuration...
setting up /etc...
reloading user units for morswin...
restarting sysinit-reactivation.target
the following new units were started: NetworkManager-dispatcher.service
warning: the following units failed: home-manager-morswin.service
Ă— home-manager-morswin.service - Home Manager environment for morswin
     Loaded: loaded (/etc/systemd/system/home-manager-morswin.service; enabled; preset: ignored)
     Active: failed (Result: exit-code) since Sun 2025-01-19 00:00:07 CET; 272ms ago
 Invocation: c12c0932c54a4e1eabe425979e2c85ec
    Process: 113196 ExecStart=/nix/store/86bam0w906mznl55b2wrixvhjix77rgy-hm-setup-env /nix/store/vq78734567wym4wx49vwwpfbl0q2h2z4-home-manager-generation (code=exited, status=1/FAILURE)
   Main PID: 113196 (code=exited, status=1/FAILURE)
         IP: 0B in, 0B out
         IO: 0B read, 0B written
   Mem peak: 5.4M
        CPU: 70ms

sty 19 00:00:07 nixos hm-activate-morswin[113221]: Please do one of the following:
sty 19 00:00:07 nixos hm-activate-morswin[113221]: - Move or remove the above files and try again.
sty 19 00:00:07 nixos hm-activate-morswin[113221]: - In standalone mode, use 'home-manager switch -b backup' to back up
sty 19 00:00:07 nixos hm-activate-morswin[113221]:   files automatically.
sty 19 00:00:07 nixos hm-activate-morswin[113221]: - When used as a NixOS or nix-darwin module, set
sty 19 00:00:07 nixos hm-activate-morswin[113221]:     'home-manager.backupFileExtension'
sty 19 00:00:07 nixos hm-activate-morswin[113221]:   to, for example, 'backup' and rebuild.
sty 19 00:00:07 nixos systemd[1]: home-manager-morswin.service: Main process exited, code=exited, status=1/FAILURE
sty 19 00:00:07 nixos systemd[1]: home-manager-morswin.service: Failed with result 'exit-code'.
sty 19 00:00:07 nixos systemd[1]: Failed to start Home Manager environment for morswin.
> Adding configuration to bootloader

I have my current flake configuration at this url: GitHub - Morswin/my-flakes

Does anybody know how I can proceed?
My main goal would be to switch to hyprland and to have working home-manager in my flakes.
It already worked, so this turn of events is upsetting.
At this point I’m fine with hyprland not being in home.nix. I just want it to work.

(I haven’t found much help regaring my issue on the internet.)

Home Manager doesn’t support rollbacks and can’t always detect if it will override a previous manual configuration. See their words of warning.

The error is asking you to backup one or more files before it writes a new configuration. You can use journalctl to see the files in the recent logs (something like journalctl -xeu home-manager-morswin.service).

You’re using Home Manager as a NixOS module, so you can also do what’s suggested in the error message (set home-manager.backupFileExtension). Personally I don’t do this as I want to know what files are causing the error and manually decide what to backup. Home Manager can really mess things up if you’re not careful (again, their words of warning).

1 Like

Yes, adding:

home-manager.backupFileExtension = "backup";

To my configuration.nix fixed the issue, and my home manager once again compiles. I didn’t know that there was such a setting.

I think it reset my kitty config to the default one. Is this the side effect you warned about? I can work my way to rebuild it in home manager settings afterwards I think. But I would be sad if it messed up my fish configs xD

Yes, but hopefully you’ll have the old files backed up with a .backup extension now. I’ve been burned in the past so prefer to deal with the errors manually.

1 Like