{ config, lib, ... }:
let
  cfg = config.modules.container;
  inherit (lib) mkIf mkEnableOption mkForce;
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 = mkForce false;
      };
    };
    virtualisation.oci-containers.backend = "podman";
  };
}