Skip to content

Latest commit

 

History

History
62 lines (51 loc) · 2.16 KB

README.md

File metadata and controls

62 lines (51 loc) · 2.16 KB

quadlet-nix

Manages Podman containers and networks on NixOS via Quadlet.

Why

Compared to alternatives like virtualisation.oci-containers or arion, quadlet-nix is special in that:

quadlet-nix oci-containers arion
Supports networks
Updates / deletes networks on change /
Supports podman-auto-update

How

flake.nix

{
    inputs = {
        nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
        quadlet-nix.url = "github:SEIAROTg/quadlet-nix";
        quadlet-nix.inputs.nixpkgs.follows = "nixpkgs";
    };
    outputs = { nixpkgs, quadlet-nix, ... }@attrs: {
        nixosConfigurations.machine = nixpkgs.lib.nixosSystem {
            system = "x86_64-linux";
            modules = [
                ./configuration.nix
                quadlet-nix.nixosModules.quadlet
            ];
        };
    };
}

configuration.nix

{
    # ...
    virtualisation.quadlet = {
        containers = {
            nginx.containerConfig.image = "docker.io/library/nginx:latest";
            nginx.containerConfig.networks = [ "host" "internal.network" ];
            nginx.containerConfig.pod = "nginx-pod.pod";
            nginx.serviceConfig.TimeoutStartSec = "60";
        };
        networks = {
            internal.networkConfig.subnets = [ "10.0.123.1/24" ];
        };
        pods = {
          nginx-pod = { };
        };
    };
}

See container.nix, network.nix, and pod.nix for all options.