I have created a module which you can use to create any symlinks. I mainly made this because I wanted to manage my hyprland config while preserving hot-reload without using home-manager but it can be used to create any symlinks and manage any dotfiles. The reason I made this is because nix lacks a way of creating arbitrary symlinks(i guess its because of its declarative nature) without external tools and using home-manager just for this felt bloated
Now, I know tmp-files already exits but it has a big problem, it doesnt clear symlinks that you have removed from your configuration meaning you will have to go and remove them manually
That’s why I created this module it automatically cleans up the symlinks that you have removed from your configuration. I would like feedback on this <3.
Technically, a good documentation example would be not of creating symlinks in user homes, because those might not be mounted at activation. They might be decrypted by user login, for example.
Essentially, if the intended usage is in user homes, perhaps it should be a home-manager module, instead?
Also, should it create user systemd units, instead?
I changed this to announcements because it does not seems to belong into the RFC announcements category
systemd-tmpfilesalready exists which also allows for arbitrary symlink creation but it has a few problems:
- It runs on every boot not just on system rebuild,
So do activation scripts. In fact they do so at a far more sensitive time during boot, which is just one of the reasons activation scripts are strongly recommended against. We really want to deprecate those once we’ve gotten rid of all the uses of them within nixpkgs.
You might also be interested in hjem, or at least smfh to avoid reinventing the wheel completely.
In particular, if the only reason you’re avoiding home-manager is “bloat”, hjem should be exactly what you’re looking for:
The interface for the hjem module is conceptually very similar to prior art (e.g., Home Manager), but it does not act as a collection of modules like Home Manager. Instead, we implement minimal features, and leave application-specific abstractions to the user to do as they see fit.
second for smfh, I have started using it outside of hejm, it’s pretty nice!
I created hmrice for this reason. GitHub - mipmip/hm-ricing-mode: Ricing mode utility for Home Manager · GitHub
what of pkgs.linkfarm?
It could be a good idea to add a NixOS module to smfh that lets you create symlinks with tmpfiles-like module interface.