I used to have a VPS running a traditional OS (CentOS) that I eventually got rid of. One of the reasons I tried to migrate away from it was from the sysadmin perspective, I felt like the server once everything was configured was a bit of a snowflake.
Obviously configuring everything through nix and being able to easily rollback changes sound very compelling.
Have folks used nix as a server OS? How’s your experience been?
First of all you are probably talking about NixOS and not Nix as a server. I was using servers in cloud as well as machines at home, using Debian, Ubuntu, OpenSUSE, Fedora, Arch and even FreeBSD.
In the cloud I was using mainly two types of setup: Kubernetes and as a normal VPS and then services on top. Over the years I discovered that my favorite setup is NixOS on VPS for my services. You might ask why NixOS and not Kubernetes, does not K8s ecosystem supports all the world’s services and you might be right. But the my argument is that NixOS is way simpler, cheaper, and with less hassle, even if some services do not exist yet for NixOS, they are simple to integrate. Also my setup is reproducible with just backups of /etc/nixos/ directory and /var/lib/ both of which can exist as storage volumes. At the end, I am very happy with my setup, and do not miss conventional OS-es and other cloud solutions.
It’s pretty great at being a server OS, honestly.
There are tons of modules that set up services well. Almost everything I’ve wanted to run already has a module and it’s as easy as
services.name.enable = true
.By far my favorite aspect has been being able to declaratively configure things like Prometheus or Traefik. It solves a problem I end up trying to solve with a lot of glue (and YAML) at work.
Being able to recover from disaster by just checking out your git repo and doing a rebuild makes everything else feel a little… hacky. You don’t need a separate system to manage config files or software versions.
I sound like a fanboy because I am. It’s been revolutionary for me.
NixOS is my main server OS for a while now. As of a couple days ago it’s also running on my home router. It’s absolutely awesome for servers, another great feature that works well for that which wasn’t mentioned yet is that you can just spin up a VM from your configuration to test stuff, and that you can easily share configuration between different servers which I make heavy use of.
Declarative configuration honestly makes everything that doesn’t have it seem janky in comparison haha
Yeah I do, and it’s awesome! I just love having a big overlap in my system configurations, so I can change something once and update my systems all simultaneously and identically. I have one Arch box left and I kinda detest having to log in on it to do system administration. My NixOS boxes can just be updated remotely and atomically, never requiring me to log in on them and do things manually. This is like Ansible on steroids! And then I’m not even talking about using impermanence yet, that totally seals the deal for me.
I’m using it on a pi 4 and it’s great