2024-09-30 22:10:38 +02:00
|
|
|
# A Comics/Manga media server
|
|
|
|
{ config, lib, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.my.services.komga;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.my.services.komga = with lib; {
|
|
|
|
enable = mkEnableOption "Komga comics server";
|
|
|
|
|
|
|
|
port = mkOption {
|
|
|
|
type = types.port;
|
|
|
|
default = 4584;
|
|
|
|
example = 8080;
|
|
|
|
description = "Internal port for webui";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
services.komga = {
|
|
|
|
enable = true;
|
|
|
|
inherit (cfg) port;
|
|
|
|
|
|
|
|
group = "media";
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.services.komga.environment = {
|
|
|
|
LOGGING_LEVEL_ORG_GOTSON_KOMGA = "DEBUG"; # Needed for fail2ban
|
|
|
|
};
|
|
|
|
|
|
|
|
# Set-up media group
|
|
|
|
users.groups.media = { };
|
|
|
|
|
|
|
|
my.services.nginx.virtualHosts = {
|
|
|
|
komga = {
|
|
|
|
inherit (cfg) port;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-11-28 22:46:55 +01:00
|
|
|
my.system.persist.directories = [
|
|
|
|
config.services.komga.stateDir
|
|
|
|
];
|
|
|
|
|
2024-09-30 22:10:38 +02:00
|
|
|
services.fail2ban.jails = {
|
|
|
|
komga = ''
|
|
|
|
enabled = true
|
|
|
|
filter = komga
|
|
|
|
port = http,https
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
environment.etc = {
|
|
|
|
"fail2ban/filter.d/komga.conf".text = ''
|
|
|
|
[Definition]
|
|
|
|
failregex = ^.* ip=<HOST>,.*Bad credentials.*$
|
|
|
|
journalmatch = _SYSTEMD_UNIT=komga.service
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|