I’m just getting started with Nix. Most of the resources I’m seeing are targeting desktop setups, and I can’t find much info about how are people using NixOS for web hosting?
What I’d like to do is run several node apps or docker containers with nginx acting as a reverse proxy on a VPS. What are the best practices? Do I need the home manager for instance? How would a configuration folder structure look like?
Any tips or links to existing tutorials would be appreciated!
Broadly, this is the subject matter of the excellent book NixOS in production. I think it would give you a very good foundation to start; it walks the reader through deploying NixOS to an AWS instance with ssh and nginx-fronted static site serving.
leverages the nix store for much smaller containers
can be managed right inside your nix config, you can freely pass config from the host to the container.
you get the whole suite of nix services, nix packages, and systemd features
Cons:
By default, sandboxxing is weaker
No networking magic for groups of containers. You need to set that up manually
Depends who you ask:
uses systemd’s container features
updates only when you update your host system
I think that wiki page has an example of a webserver running apache and a firewall, ergonomically it feels more like LXC than Docker because you could have multiple programs/services in a single container.