44 lines
1.1 KiB
Nix
44 lines
1.1 KiB
Nix
{
|
|
config,
|
|
pkgs,
|
|
...
|
|
}:
|
|
{
|
|
virtualisation = {
|
|
containers.storage.settings = {
|
|
# configure for zfs.
|
|
storage = {
|
|
driver = "zfs";
|
|
graphroot = "/var/lib/containers/storage";
|
|
runroot = "/run/containers/storage";
|
|
options.overlay.mountopt = "nodev,metacopy=on";
|
|
};
|
|
};
|
|
|
|
## setup podman.
|
|
podman = {
|
|
enable = true;
|
|
dockerCompat = true;
|
|
defaultNetwork.settings.dns_enable = true;
|
|
extraPackages = [ pkgs.zfs ];
|
|
extraRuntimes = [ pkgs.gvisor ];
|
|
};
|
|
|
|
oci-containers = {
|
|
## use podman as the default container engine.
|
|
backend = "podman";
|
|
};
|
|
};
|
|
|
|
# compose
|
|
systemd.services.podman.serviceConfig.Environment =
|
|
"PODMAN_COMPOSE_PROVIDER=${pkgs.docker-compose}/bin/docker-compose";
|
|
# "PODMAN_COMPOSE_PROVIDER=/run/current-system/sw/bin/docker-compose";
|
|
environment.systemPackages = with pkgs; [ docker-compose ];
|
|
environment.extraInit = ''
|
|
if [ -z "$DOCKER_HOST" -a -n "$XDG_RUNTIME_DIR" ]; then
|
|
export DOCKER_HOST="unix://$XDG_RUNTIME_DIR/podman/podman.sock"
|
|
fi
|
|
'';
|
|
}
|