Manages Podman containers and networks on NixOS via Quadlet.
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 | ✅ | ✅ | ❌ |
{
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
];
};
};
}
{
# ...
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.