{ config, pkgs, inputs, ... }: {

  sops.secrets.roombot = {
    sopsFile = ../../../secrets/ps2live/saerro.yaml;
  };

  sops.secrets.plapkit = {
    sopsFile = ../../../secrets/ps2live/saerro.yaml;
  };

  virtualisation.oci-containers.containers = {
    roombot_ps2c = {
      image = "ghcr.io/planetside-community/discord-room-bot/bot:latest";
      environment = {
        WATCH_CHANNEL_PS2 = "251073753759481856:1117262244988858508";
      };
      environmentFiles = [
        config.sops.secrets.roombot.path
      ];
    };

    plapkit = {
      image = "noe/plapkit:latest";
      imageFile = inputs.plapkit.packages.${pkgs.system}.container;
      ports = [ "8555:8555" ];
      environment = {
        DSI_FIELD_NAME = "system[front]";
        PK_SYSTEM_ID = "e6bd7a02-42c5-43f1-8cd5-250c90638cf3";
        FEDI_ALTS = ''{ "aki": "@aki@porcelain.doll.repair", "hide": "@hid@porcelain.doll.repair", "ethyl": "@ethyl@porcelain.doll.repair", "sayaka": "@saya@porcelain.doll.repair" }'';
      };
      environmentFiles = [
        config.sops.secrets.plapkit.path
      ];
    };
  };

  systemd.services.restart-upgrade-extras = {
    serviceConfig.Type = "oneshot";
    script = ''
      ${pkgs.podman}/bin/podman pull ${config.virtualisation.oci-containers.containers.roombot_ps2c.image}

      systemctl restart podman-roombot_ps2c
    '';
  };

  systemd.timers.restart-upgrade-extras = {
    wantedBy = [ "timers.target" ];
    timerConfig = {
      Unit = "restart-upgrade-extras.service";
      OnUnitActiveSec = "690m";
    };
  };
}
