{ config, lib, pkgs, ... }: { imports = [ ]; options.me = { podman.enable = lib.mkOption { type = lib.types.bool; default = false; example = true; description = "Whether we want to install podman."; }; }; config = lib.mkIf config.me.podman.enable ( lib.mkMerge [ { assertions = [ { assertion = !config.me.docker.enable; message = "podman conflicts with docker"; } ]; } { environment.systemPackages = with pkgs; [ dive podman-tui podman-compose ]; # Write config files in /etc/containers virtualisation.containers.enable = true; # By default this includes "quay.io" which leads to prompting for which registry to download from. virtualisation.containers.registries.search = [ "docker.io" ]; virtualisation = { podman = { enable = true; # Install docker shim dockerCompat = true; # Support name resolution in podman-compose. defaultNetwork.settings.dns_enabled = true; }; }; environment.variables = { # For compatibility with tools expecting a docker socket (like dive). DOCKER_HOST = "unix://$XDG_RUNTIME_DIR/podman/podman.sock"; }; environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) { hideMounts = true; directories = [ { directory = "/var/lib/containers"; user = "root"; group = "root"; mode = "0755"; } ]; users.talexander = { directories = [ { directory = ".local/share/containers"; user = "talexander"; group = "talexander"; mode = "0700"; } ]; }; }; } ] ); }