{ pkgs, lib, config, ... }:

with lib;

let
  cfg = config.settings.services.podman;
in {
  options = {
    settings.services.podman.enable = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = ''
        Enable podman configuration
      '';
    };
  };

  config = mkIf cfg.enable {
    virtualisation.containers.enable = true;
    virtualisation.podman = {
      enable = true;
    };

    environment.etc."systemd/user-generators/podman-user-generator" = {
      source = "${pkgs.podman}/lib/systemd/user-generators/podman-user-generator";
      target = "systemd/user-generators/podman-user-generator";
    };
  };
}
