I want to create symlinks in NixOS
Particularly, I want to symlink /etc/nixos to /home/malix/Repositories/Malix_Labs/dotfiles/nix
How to do that ?
I want to create symlinks in NixOS
Particularly, I want to symlink /etc/nixos to /home/malix/Repositories/Malix_Labs/dotfiles/nix
How to do that ?
If /etc/nixos shall be the link that points to /home/malix/Repositories/Malix_Labs/dotfiles/nix, then you’d environment.etc.nixos.source = "/home/malix/Repositories/Malix_Labs/dotfiles/nix", IIRC.
If you want it the other way around, use systemd.tmpfiles.rules, you can learn more details about systemd-tmpfiles in the systemd docs.
Correct me if I’m wrong, but I think using environment would not work there, since:
I think environment.etc actually make an immutable copy of the target (/home/malix/Repositories/Malix_Labs/dotfiles/nix) in the nix store and symlink to it instead of symlinking to the target itself (which would be a dealbreaker)
Indeed this seems to be the right solution in any case
Also one could use system.activationScripts and make an imperative script featuring ln, but it’s better to rely on the declarative and idempotent systemd.tmpfiles.rules
You’re wrong. So long as you set it to a string and not a path, then the symlink target will simply be the string you supply. No copying.
Note that home-manager’s home.file option specifically codes around this behavior to make it always copy, even with a string, which most experienced nixers I know consider incredibly broken behavior, but rycee has no intention of changing it, so it is what it is. There, you need to use a special home-manager-only lib function to get around the useless wall he put in your way…
ah okay!
Yes I shot myself in the foot with this issue and assumed that the same behavior was happening with NixOS’ environment, hence my confusion
Thanks!