{ config, lib, ... }:
let
  cfg = config.modules.container;
  inherit (lib) mkIf mkEnableOption;
in
{
  imports = [
    ./kitchenowl
    ./nginxproxymanager.nix
  ];

  options.modules.container = {
    enable = mkEnableOption "container support";
  };

  config = mkIf cfg.enable {
    virtualisation.podman = {
      enable = true;
      autoPrune.enable = true;
      dockerCompat = true;
      defaultNetwork.settings = {
        # Required for container networking to be able to use names.
        dns_enabled = false;
      };
    };
    virtualisation.oci-containers.backend = "podman";
  };
}
