{ pkgs
, lib
, config
, ... }: with lib; let
  cfg = config.global.oci;
in {
  options.global.oci = {
    enable = mkEnableOption "oci container runtime";
  };

  config = mkIf cfg.enable {
    virtualisation.podman = {
      enable = true;
      enableNvidia = with config.global.gpu; mkDefault type == "prime" || type == "nvidia";
      dockerCompat = true;
    };

    users.home.persist.directories = [ ".local/share/containers" ];
    environment.persistence."/nix/persist/fhs".directories = [ "/var/lib/containers" ];
  };
}
