Let’s make managing infrastructure on your own machine less cumbersome. Simplify it with NixOS and containers.
NixOS is probably the or one of the distributions where you need docker the least.
That’s not to say you shouldn’t use it, but it makes less sense to me than on other systems, and you lose out on some of the good stuff from what I understand (no module system configuration for imported docker containers for example? I have never tried this).
You can already manage your dependencies very accurately with Nix, no need to ship them all in a container; and if you use containers for isolation, there are stronger mechanisms available, e.g. MicroVM.nix.
I know. I pasted this from Reddit. We have like 0 articles here. In fact, if you’re doing it this way, you are doing it wrong.
Podman provides stronger isolation than nixos-containers because the latter only supports rootful containers. Losing access to nixos modules is a disadvantage, altough most services I’d use podman containers for don’t have any modules anyway.
E.g. I’ve used nixos container as a stop gap to use a major beta, because I didn’t manage to adapt the nixos package accordingly.
I use NixOS for running multi-node k3s in my home environment
See, now THIS is even more useful.
I was specifically looking to create podman containers the previous week, thank you for this! (Even if I eventually figured that I don’t really need them that much now.😅)
Way I see it the only reasons to use docker on nixos is if:
- you need many instances of the same service running on the same hw for some reason
- you’re trying to run a service that’s only packaged as a docker image
That said using nixos inside a docker container is an appealing proposition in that you get all the usual advantages of nix but can run it anywhere you can run docker images
I’d definitely use it (and I do) for deploying remote software and for the use cases you mentioned. Still, we can all agree that, in the context of Nixos, native derivations are superior and almost always preferred. I am currently using a flatpak of zen-browser until the derivations can get added to nixpkgs. But that’s just a temporary patch that I will remove soon. I have also seen containers outperform Nix in software that strictly enforces the FHS style and doesn’t play nicely in the immutable world.
I’m more into built-in nixos containers for personal use, and fall back to podman only if smth I want isn’t already packaged, and I’m too lazy to do it myself at the moment. Although, this is pretty usecase-specific, I guess: in mine the benefits mostly come from a wrapper I have around them that automates routine stuff like configuring networking, putting them on my tailnet, giving 'em hostnames indide LAN indide via caddy in case sb not on my tailnet happens to visit, collecting logs and so on. Also, there used to be an option to automate explosion yo the web via funnel, but that kinda doesn’t work with headscale, afaik