I use several Linux distributions and really like the way NixOS lets me describe my system in /etc/nixos/configuration.nix. I can keep the configuration as plain text, install software from it, and reuse the same setup on another machine. Are there comparable tools or approaches for Debian-, RPM-, or Arch-based distributions?
4 Answers
You can also install Nix itself on many other distributions and use Nix packages or flakes without switching the entire operating system to NixOS. That gives you some of the declarative and reproducible benefits while keeping the host distribution unchanged.
Guix is another declarative system worth looking at, although it is its own distribution rather than a Debian, RPM, or Arch-based solution. For simpler needs, a setup script or package list may be enough; you can export the packages you have installed and reinstall them on a new machine.
Ansible is probably the closest general-purpose option. You describe the desired packages, configuration files, users, and services in playbooks, then apply those playbooks to one or more machines. It is not identical to NixOS, but it works well for reproducible setups across different distributions.
There is not really one tool that behaves exactly like the NixOS configuration system for every traditional distribution. Kickstart can automate installations, while Ansible or shell scripts can configure an existing system. Together, they can cover most of the same practical use cases.

That sounds useful, especially since I would like to automate more than just package installation.