But to be fair, Nix is not the only answer to that. There are lots of tools for just dotfiles but you can also build something using e.g. ansible to manage everything.
All my computers have their config in a git repo. That includes users, packages, services, dotfiles, /etc configs and so on. I used ansible before writing my own tool. I can install Arch from scratch and only need to partition, run one script and then apply my config on first boot using my tool to have my system restored. I know it’s not as declarative and absolute/reproducible as Nix, but it works and it’s way less painful than my last attempt at giving NixOS a go.
Either my Ansible knowledge is too limited which is entirely possible, or you can’t do stuff there that’s possible with Nix. Let’s stay go with my example that you have something that requires changes in PAM. So you write an Ansible file installing the package (which is distribution-specific, so you’re losing one advantage you had over NixOS), enable the service and add your entries to the respective PAM file (e.g. login because you want to enable user authentication against kanidm on your machine). The ordering in these files matter. Sure you have insertbefore and insertafter for lineinfile and blockinfile, but this basically requires you to know the rest of the file in advance… not a problem if your system is always the same, but you don’t have the flexibility and composability that Nix offers.
I’d say, from my experience with Ansible, that it can absolutely do all of that. Might be able to use a single task for the package install, if the distro supports the generic package module. There’s also a pamd module that would likely cover your needs there. If not, it would still be possible with a custom module or some Xinfile fuckery (if it can be fine programmatically, it can be done in Ansible, more niche things may require writing code, however).
It would not be as terse though. Really wish there was a good middle ground.
But to be fair, Nix is not the only answer to that. There are lots of tools for just dotfiles but you can also build something using e.g. ansible to manage everything.
All my computers have their config in a git repo. That includes users, packages, services, dotfiles, /etc configs and so on. I used ansible before writing my own tool. I can install Arch from scratch and only need to partition, run one script and then apply my config on first boot using my tool to have my system restored. I know it’s not as declarative and absolute/reproducible as Nix, but it works and it’s way less painful than my last attempt at giving NixOS a go.
Either my Ansible knowledge is too limited which is entirely possible, or you can’t do stuff there that’s possible with Nix. Let’s stay go with my example that you have something that requires changes in PAM. So you write an Ansible file installing the package (which is distribution-specific, so you’re losing one advantage you had over NixOS), enable the service and add your entries to the respective PAM file (e.g. login because you want to enable user authentication against kanidm on your machine). The ordering in these files matter. Sure you have
insertbefore
andinsertafter
forlineinfile
andblockinfile
, but this basically requires you to know the rest of the file in advance… not a problem if your system is always the same, but you don’t have the flexibility and composability that Nix offers.I’d say, from my experience with Ansible, that it can absolutely do all of that. Might be able to use a single task for the package install, if the distro supports the generic
package
module. There’s also a pamd module that would likely cover your needs there. If not, it would still be possible with a custom module or some Xinfile fuckery (if it can be fine programmatically, it can be done in Ansible, more niche things may require writing code, however).It would not be as terse though. Really wish there was a good middle ground.