{ config, lib, ... }:

{
  services.komga = {
    enable = true;

    settings = {
      server = {
        # Not actually set here, but in the secret.
        port = 44302;
      };
    };
  };

  systemd.tmpfiles.settings."10-komga" = {
    "${config.services.komga.stateDir}/application.yml" = lib.mkForce {};
  };

  age.secrets = {
    nayru-conf = {
      file = ../../../secrets/zora/services/nayru-conf.age;
      path = "${config.services.komga.stateDir}/application.yml";
      owner = "komga";
      group = "komga";
    };
  };
}
