{
  self,
  hostPath,
  tree,
  inputs,
  config,
  pkgs,
  ...
}: let
  containerAddresses = import "${hostPath}/data/containerAddresses.nix";
  hostIP = containerAddresses.host;
  containerIP = containerAddresses.containers.caldav;
in {
  containers.caldav = {
    autoStart = true;
    privateNetwork = true;
    hostAddress = hostIP;
    localAddress = containerIP;

    specialArgs = {
      inherit inputs;
      inherit tree;
      inherit self;
      inherit hostPath;
    };

    config = {...}: {
      nixpkgs.pkgs = pkgs;

      imports = with tree;
        [
          presets.nixos.containerBase
          ./secrets.nix
        ]
        ++ (with hosts.hetzner-arm.containers.caldav.profiles; [
          radicale
          restic
        ]);

      networking.firewall.allowedTCPPorts = [5232];

      home-manager.users.root.home.stateVersion = "23.05";
      system.stateVersion = "23.05";
    };
  };

  services.nginx = {
    enable = true;
    virtualHosts."radicale.owo.monster" = {
      enableACME = true;
      forceSSL = true;
      locations."/".proxyPass = "http://${containerIP}:5232";
    };
  };
}