Yes you can do that, as I did it before switching to flakes.
Nix / NixOS
Main links
Videos
Thanks! it's good to know, I was worried about breaking stuff on an unfamiliar system π
Check out gnu stow. Its designed exactly for this.
Edit: added link
Yes that's what I'm using, it's really a great program! But I was wondering if configuration.nix being a symlink would cause problems or if it was fine
Edit: Ah someone else already replied that it was fine π
To my knowledge, symlinking a Nix file is perfectly fine (though may have interesting behavior with flakes).
Thanks for the reply! Not using flakes so I won't have to worry about that, things are already confusing enough π
The nix wiki actually contains a way to handle this. If you look up βNixOS configuration editorsβ it has a couple quick commands to make a folder in your user space and link it to the default location of your nix config. This allows you to edit your config without having to escalate privileges of your editor.
The "nix way" to handle this is actually to have all your dotfiles generated and "installed" by Nix as part of your NixOS config (via home-manager), and keep your NixOS config in a git repo that you then nixos-rebuild from (either with nixos-rebuild switch -I nixos-config=. or nixos-rebuild switch --flake ., depending on if you're using flakes or not).
So Iβm kinda wary of doing it on an even more critical file
Actually, configuration.nix is not critical to the functioning of the system at all; it is only read at "evaluation time", i.e. when you are using nixos-rebuild. As long as it's under a VCS (i.e. you won't lose the contents by the time you want to nixos-rebuild again), you have nothing to worry about. You can ship a NixOS system without it (in fact that's kind of the default). (unrelated but fun fact: you can also ship a NixOS system without Nix, it's not actually needed for it to run!)
That's reassuring thanks! I'm not planning on using home manager for now because it makes more sense to keep original config files so I can use them both on Nix and Arch, but I'll need to look into it when I set up my media server (I know I know, reasonable people just do a debian server, but that seems really boring π ).
unrelated but fun fact: you can also ship a NixOS system without Nix, itβs not actually needed for it to run! Wait without which Nix? the package manager or the language or something else? (Why is EVERYTHING called "Nix"? π )
Wait without which Nix? the package manager or the language or something else?
Yes, without the package manager. Shipping "with a language" doesn't make much sense :)