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?

  • cdombroski@programming.dev
    link
    fedilink
    English
    arrow-up
    3
    ·
    28 days ago

    If the package you’re using stays up to date and doesn’t require much setup, you could plug a dockerTools.buildLayeredImage into the imageFile attribute. The name and the tag in the built image should match what’s in the image attribute. An example (busybox is only included for debugging):

            image = "my-calibre-web:latest";
            imageFile = pkgs.dockerTools.buildLayeredImage {
              name = "my-calibre-web";
              tag = "latest";
              contents = [ pkgs.busybox ];
              config.Cmd = [
                "${pkgs.calibre-web}/bin/calibre-web"
                "-p"
                "/config/app.db"
                "-g"
                "/config/gdrive.db"
                "-i"
                "0.0.0.0"
              ];
            };