- Pretty permalinks for this post:
- https://fireburn.ru/posts/1605296738
- Also published on:
- https://twitter.com/kisik21/status/1327336860838977536
I guess my favorite #NixOS feature of the year is lightweight NixOS containers.
Got a piece of legacy software that won’t compile anymore with newer libraries? Stick it in a NixOS container with pinned Nixpkgs and it works as if it never got broken.
Sudden regression in unstable branch broke one of your services, but another service got a security patch to install? Stick the service that doesn’t update in a container with Nixpkgs lagging a few versions behind until the regression gets fixed.
As a bonus, you get less clutter in host’s /var and optional network separation. And a cool hostname.containers domain name on the host so you don’t need to remember which container got which IP assigned.
The containers work just like a NixOS system inside a NixOS system - just do something like this…
{ ... }: {
containers.demo = {
autoStart = true;
# do this if you want to build a different version of NixOS
pkgs = import <nixpkgs> {};
config = import ./containers/demo.nix;
};
}