Skip to content

nh home switch does not show activtaion errors #350

@girlpunk

Description

@girlpunk

I recently encountered an issue caused by a leftover configuration file that was created by an application before its config was generated. This in of itself is not an issue with nh, however this took some time to diagnose as nh did not report this error. This was the output from nh:

argon% nh home switch
warning: Git tree '/xxx/nix' is dirty
> Building Home-Manager configuration
warning: Git tree '/xxx/nix' is dirty
Finished at 09:38:43 after 0s
> Comparing changes
<<< /home/xxx/.local/state/nix/profiles/home-manager
>>> /tmp/nh-homek0Yp4R/result
Version changes:
[omitted for brevity]
Added packages:
[omitted for brevity]
Removed packages:
[omitted for brevity]
Closure size: 952 -> 978 (51 paths added, 25 paths removed, delta +26, disk usage +21.8MiB).
> Activating configuration
argon%

This gives no indication that an error occurred, other than the resultant config not working. Running the equivalent home-manager command correctly shows the error:

argon% home-manager switch --flake /xxx/nix#xxx@argon 
warning: Git tree '/xxx/nix' is dirty
evaluation warning: _1password has been renamed to _1password-cli to better follow upstream name usage
Starting Home Manager activation
Activating changesReport
<<< /nix/store/525jjlf7qvpyqwgba4yvlprw2i610ys7-home-manager-generation
>>> /nix/store/f7n5va7cwiignfawz24ijam6yh85s96q-home-manager-generation
Version changes:
[omitted for brevity]
Added packages:
[omitted for brevity]
Removed packages:
[omitted for brevity]
Closure size: 952 -> 978 (51 paths added, 25 paths removed, delta +26, disk usage +21.8MiB).
Activating checkFilesChanged
Activating checkLinkTargets
Existing file '/home/xxx/.config/rofi/config.rasi' is in the way of '/nix/store/5f834rbmjbpjqgj0cmrgy9s4qwbikl71-home-manager-files/.config/rofi/config.rasi'
Please do one of the following:
- Move or remove the above files and try again.
- In standalone mode, use 'home-manager switch -b backup' to back up
  files automatically.
- When used as a NixOS or nix-darwin module, set
    'home-manager.backupFileExtension'
  to, for example, 'backup' and rebuild.
argon%

Notably, the warning about 1password being renamed was also not shown by nh.

Expected behavior: nh should show both the warning and error that home-manager does in this situation.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions