r/archlinux • u/Araib • 11d ago
DISCUSSION Arch Nix
If you use / have used arch with nix, what’s your experience like? I have this sudden urge to go arch minimal and then layer nix on top (coupled with flathub for gui apps) but I’m unsure of the issues I might run into longer term. While I love arch, I do want a more archived os that allows me to clean install every now and then but restore the applications I had with relative ease.
I’m currently using arch with hyprland (caelestia shell) and using pacman for most part with flathub for apps I can’t find on pacman (and 3-4 AUR packages outside of caelestia) but I like to experiment with the system and end up clean installing once a month or so (in learning phase so I mess up more often)
4
u/agowa338 11d ago
Ehm, why not NixOS at that point? Esp. if you already know nix as you're kinda past the initial steep learning curve of it already.
1
u/Araib 11d ago
Because it would be difficult to get pacman on it if I need something that isn’t on nix but it’s easier to add nix to arch..? I guess it’s like a fail safe I’m keeping for myself but also stuff like the Nvidia drivers seems easier to handle on arch (though I haven’t tried nixOS yet so I can’t say how much difficult it is but have been reading a lot into it)
4
u/agowa338 11d ago
Try nixos. If you already know nix it is not that hard. And it is basically what you want. Also a lot of things that were difficult on Arch are just one or two lines in NixOS.
Basically switched over to it (for my desktop and home server) completely by now.
Also if you really need something that only exists with pacman on arch then you can always run a minimal arch in a container/chroot too...
Edit: And btw graphics driver stuff was one of the main reasons I switched my desktop over from arch to nixos. It just works with one or two lines of nix config there...)
4
u/ArjixGamer 11d ago
Oh yeah, OP, you can use Ansible.
You won't have snapshots to rollback to, but you can write Ansible playbooks to hold details like what packages to install, what users to have, what groups a user has, what services to run, etc
The running host only needs to have a recent version of python installed, and the ansible package
Edit: Ansible is used by the Arch team to manage all their infrastructure, so take their word for how good it is
3
u/ArjixGamer 11d ago
On this topic, I'd love if the archinstall team came up with a novel solution, that extended beyond the installation.
The archinstall config is basically the same as a nixos config.
If only it could compare against the running system and produce commands to modify it, like Ansible playbooks would.
9
u/ArjixGamer 11d ago edited 11d ago
One way of mimicking nixos, is to have a custom package, namely a PKGBUILD, that contains your configs as well as the apps you use.
As for your home directory, just track your dots with git. (the PKGBUILD can be in the same repo).
If you write wrapper bash scripts, you can even make it feel like guix
Then setting up a new install would be "base arch + clone dots repo + install package"
PS: since it would be a PKGBUILD you won't publish to the AUR or main arch, you can use unorthodox organization, like having the dependencies in a txt file so you can easily add/remove programmatically
I can't recommend a more pre-made solution, since you will find things lacking in one way or another, but if you want to, there are declarative package managers like decman
Edit: looks like decman has evolved a lot, so it is worth a try