Flake + Homemanager backup

I used to have my system working but started getting an error with a package from an unstable file so updating my system to 24.05 on all my packages. But in the process my system is unable to build because something is conflicting. I am unable to get home-manager to backup with the setting that was suggest nor the command line. My flake and home-manager build as one.

Here is my error code:

justin@nixos:~/.dots/modules/wm/hyprland/ > rebuild-desktop
warning: Git tree '/home/justin/.dots' is dirty
building the system configuration...
warning: Git tree '/home/justin/.dots' is dirty
trace: warning: justin profile: The option `programs.zsh.enableAutosuggestions' defined in `/nix/store/0hby9z8dhpi1pqidnwhjhxbn69gyc1cm-source/home/justin.nix' has been renamed to `programs.zsh.autosuggestion.enable'.
trace: warning: The option `services.avahi.nssmdns' defined in `/nix/store/0hby9z8dhpi1pqidnwhjhxbn69gyc1cm-source/hosts/nixos/seykota/default.nix' has been renamed to `services.avahi.nssmdns4'.
activating the configuration...
setting up /etc...
reloading user units for justin...
restarting sysinit-reactivation.target
warning: the following units failed: home-manager-justin.service

× home-manager-justin.service - Home Manager environment for justin
     Loaded: loaded (/etc/systemd/system/home-manager-justin.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Sun 2024-07-14 09:02:31 UTC; 79ms ago
   Duration: 20min 33.982s
    Process: 4043753 ExecStart=/nix/store/6mhjswwdl1b6msyiml5bxmdqrhhi6x36-hm-setup-env /nix/store/zqn2n7n9vnvq9ggfd66zg4i18bga821f-home-manager-generation (code=exited, status=1/FAILURE)
   Main PID: 4043753 (code=exited, status=1/FAILURE)
         IP: 0B in, 0B out
        CPU: 78ms

Jul 14 09:02:31 nixos hm-activate-justin[4043831]: Please do one of the following:
Jul 14 09:02:31 nixos hm-activate-justin[4043831]: - Move or remove the above files and try again.
Jul 14 09:02:31 nixos hm-activate-justin[4043831]: - In standalone mode, use 'home-manager switch -b backup' to back up
Jul 14 09:02:31 nixos hm-activate-justin[4043831]:   files automatically.
Jul 14 09:02:31 nixos hm-activate-justin[4043831]: - When used as a NixOS or nix-darwin module, set
Jul 14 09:02:31 nixos hm-activate-justin[4043831]:     'home-manager.backupFileExtension'
Jul 14 09:02:31 nixos hm-activate-justin[4043831]:   to, for example, 'backup' and rebuild.
Jul 14 09:02:31 nixos systemd[1]: home-manager-justin.service: Main process exited, code=exited, status=1/FAILURE
Jul 14 09:02:31 nixos systemd[1]: home-manager-justin.service: Failed with result 'exit-code'.
Jul 14 09:02:31 nixos systemd[1]: Failed to start Home Manager environment for justin.
warning: error(s) occurred while switching to the new configuration

Hi, i have a similar issue. The error message suggest to move or remove a file, but i don’t know wich file is causing the conflict.

× home-manager-julmx.service - Home Manager environment for julmx
     Loaded: loaded (/etc/systemd/system/home-manager-julmx.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Sun 2024-07-14 11:26:16 CEST; 75ms ago
   Duration: 23h 36min 31.246s
    Process: 2081057 ExecStart=/nix/store/6mhjswwdl1b6msyiml5bxmdqrhhi6x36-hm-setup-env /nix/store/z6lhz8hp2w66rvkpxlk7q9w4wd52wzr7-home-manager-generation (code=exited, status=1/FAILURE)
   Main PID: 2081057 (code=exited, status=1/FAILURE)
         IP: 0B in, 0B out
        CPU: 136ms

juil. 14 11:26:16 mainPC hm-activate-julmx[2081154]: Please do one of the following:
juil. 14 11:26:16 mainPC hm-activate-julmx[2081154]: - Move or remove the above files and try again.
juil. 14 11:26:16 mainPC hm-activate-julmx[2081154]: - In standalone mode, use 'home-manager switch -b backup' to back up
juil. 14 11:26:16 mainPC hm-activate-julmx[2081154]:   files automatically.
juil. 14 11:26:16 mainPC hm-activate-julmx[2081154]: - When used as a NixOS or nix-darwin module, set
juil. 14 11:26:16 mainPC hm-activate-julmx[2081154]:     'home-manager.backupFileExtension'
juil. 14 11:26:16 mainPC hm-activate-julmx[2081154]:   to, for example, 'backup' and rebuild.
juil. 14 11:26:16 mainPC systemd[1]: home-manager-julmx.service: Main process exited, code=exited, status=1/FAILURE
juil. 14 11:26:16 mainPC systemd[1]: home-manager-julmx.service: Failed with result 'exit-code'.
juil. 14 11:26:16 mainPC systemd[1]: Failed to start Home Manager environment for julmx.
warning: error(s) occurred while switching to the new configuration

Looks like the important part of the journal is being cut off. You’ll need to read the full log of the service.

@Rabid3east try:

journalctl -e --user --unit home-manager-justin.service

@julmx try:

journalctl -e --user --unit home-manager-julmx.service 

The CLI option cannot apply to the NixOS module (and you should get an explicit error, not getting one isn’t a good sign?), though the option should work.

Going on a tangent here, but that means you have updated, there’s just one config file that isn’t being applied during the activation script. This only happens with home-manager, when some random application overwrites its symlinks. IME this usually happens with the mime config files, since wine applications don’t handle symlinks well.

got it to rebuild using :

home-manager.backupFileExtension = "bkp";

then, i get the same issue again.
Apparently, the .bkp files create a conflict too, so i used

find . -name '*.bkp'

to find and remove the *.bkp files created. I suppose there is a better way to do it.

Maybe our issue is related to this :

journalctl -e --user --unit home-manager-julmx.service 

return “No entrie”, maybe because i successfully rebuild my conf ?

Oh, whoops, sorry, it’s not a user service. Drop the --user and it should give you logs.

You could also just check which file was backed up, just need to figure out what application is overwriting your symlink and why.

thanks, i see which file is causing the conflict :

juil. 14 15:49:44 mainPC hm-activate-julmx[2489178]: Existing file '/home/julmx/.config/mimeapps.list.bkp' would be clobbered by backing up '/home/julmx/.config/mimeapps.list'

Yeah, as expected. IME this is when you start wine applications that register a new mime type on startup. I believe wine doesn’t support symlinks and turns them into normal files whenever that happens.

Best way to fix that is to look at what mime handlers get randomly registered and writing them to the list yourself.

It doesn’t cause the deployment to fail, anyway, this is more of a warning.

1 Like

After removing --user to the command i was able to narrow down the conflicting file from alacritty and remove it. Everything is working as intended, thank you!

1 Like