Can I determine where a symlink came from, with home-manager?

I have a weird problem, where symlinks that I’ve removed from home-manager are still present.

I use flakes and home-manager as a module, using nixos-rebuild remotely.

I’ve tried cleaning garbage, using both my user and super user, but it’s still there.

Can I somehow query it to see why it’s there?:wink:

readlink <path>?

And reminder, gc is not a debugging strategy.

Right, so this is a symlink, but I’ve removed the entry in my config file, so why does it still create it or why does it not remove it?

[b0ef@x230:~]$ readlink agenda 
/nix/store/qr8mn6c8pa9y1p70fxgshirbcp7nxhd1-home-manager-files/agenda

[b0ef@x230:~]$ readlink /nix/store/qr8mn6c8pa9y1p70fxgshirbcp7nxhd1-home-manager-files/agenda
/nix/store/b9wix7qfca6jdshpsvvnks9sdjw69pa4-hm_agenda

[b0ef@x230:~]$ readlink /nix/store/b9wix7qfca6jdshpsvvnks9sdjw69pa4-hm_agenda
/home/b0ef/ds/platform/agenda

I’m not sure I understand this; what exactly is supposed to work?

  1. When I remove a symlink in my flake, is it supposed to be removed when I nixos-rebuild?
  2. When I remove a symlink in my flake, do I have to gc as the user owning the symlink to make it be gone?
  3. When I remove a symlink in my flake, do I have to gc as superuser to make it be gone?

Now that none of these works, how can I figure out why it never gets removed?

Evidently you still have some mkOutOfStoreSymlink reference to agenda in your config. And again, gc is unrelated, forget about gc.

1 Like