this post was submitted on 14 Nov 2024
35 points (100.0% liked)

Nix / NixOS

1785 readers
44 users here now

Main links

Videos

founded 1 year ago
MODERATORS
 

I experimented with several ways to run my services:

  1. "regular" systemd services (services.glance = { ... };)
  2. nix containers (containers.glance = { ... };)
  3. podman containers (virtualisation.oci-containers.containers.glance = { ... })

and I must say I'm starting to appreciate the last option (the least nixos-y) more and more.

Specifically, I appreciate that:

  • I just have to learn the app/container configuration, instead of also backwards-translating from their config into the various nixos options (of course the .yaml or whatever configuration files are still generated from my nixos config, I just do that in a derivation instead on relying on a module doing it for me)
  • Services are sometimes outdated in nixpks (even in unstable - and juggling packages between stable and unstable is yet another complication)
  • I feel like it's more secure (very arguable and also of very little consequence since everything is on my homelab... it's mainly for the warm fuzzies)

Do you guys use one of the options above? Something different?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 2 points 1 week ago

I use systemd services when I can, and fall back to podman containers when - for one reason or another - the systemd services aren't a viable option. There are currently two services I run in containers: the glitch-soc fork of Mastodon (because I have no desire to compile it myself, and their container image is the next best thing), and Wallabag (because at the time I made my config, the nixos module for it wasn't in a good shape). Everything else (about a dozen other services) runs as a systemd service.

My primary reason for this is that before NixOS, I used containers for all of these, and keeping them updated and functional and at a reasonable size was a pain in the backside to say the least. Especially if I wanted to patch something (I often patch my Forgejo instance, for example). If I need a patched version, or an updated version, I can easily do that with overriding a few attributes in the vast majority of cases - I do not juggle stable & unstable.

Using the NixOS-provided modules also allow me to configure all of these using the same language: Nix. While it's not a language I like, I hate it much less than I hate YAML and all the others. Using Nix for configuration lets me wrap it all in Org Roam, easily, which makes it very easy to document my configuration thoroughly and completely, and also allows me to organize it in a way that makes sense to me. Generating YAML from Org is a much, much, much more painful thing.