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?

  • jboyens@beehaw.org
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    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.

  • chayleaf@lemmy.ml
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    I absolutely love Nix as a server OS. In fact I started using it as a server OS before over a year before setting it up on my desktop.

    I live in Russia, and I started using it before 24.02.2022 on free Oracle VPS (I had to do some magic to create a BTRFS Nix image, but if you’re fine with ext4 you can just use nixos-infect). Later, Oracle stopped working in Russia (although I couldn’t log in, the server was still accessible, and might be accessible still - I haven’t checked), so I copied /var/lib and /etc/nixos to a spare laptop I had lying around - and it just worked! Before that I used Oracle Linux (RHEL derivative), and it was frankly a pain to deal with - I had to manually update some parts, I had to manually deal with configuration files, I had to remember what exactly I changed, etc; now I could simply copy everything over and it worked (with the exception of Nextcloud plugins, which are sometimes arch-dependent and not supported by NixOS).

    Now I have my config for all systems in a single flake (personal laptop, server, and TODO router, before this I ran the server in a container on the router but that was less than ideal so I bought separate hardware for the router and am in process of revamping the config at the moment) and it’s even more convenient as I can share stuff between configs, and I switched to using home-manager to have all the same benefits apply to dotfiles.

    That said, I wouldn’t recommend going all in on Nix like me if you aren’t familiar with functional programming/aren’t willing to learn. While Nix has some less-than-ideal parts, in my opinion the language is very very good for its age, but it isn’t a C-family language.

  • eursec@feddit.nl
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    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.

  • 2xsaiko@discuss.tchncs.de
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    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

  • Matej@matejc.com
    link
    fedilink
    English
    arrow-up
    0
    arrow-down
    1
    ·
    1 year ago

    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.