nixos/komga: fix settings option and default

Use freeform submodule to make default visible in search and
prevent the warning about the old option format being used.
See https://github.com/NixOS/nixpkgs/pull/345594#issuecomment-2506816155
This commit is contained in:
éclairevoyant 2025-01-12 09:59:35 -05:00
parent 2fdec2c2e6
commit 5abcff7ab1
No known key found for this signature in database
GPG Key ID: E3813AEAA02DB54B

View File

@ -8,7 +8,12 @@
let
cfg = config.services.komga;
inherit (lib) mkOption mkEnableOption maintainers;
inherit (lib.types) port str bool;
inherit (lib.types)
port
str
bool
submodule
;
settingsFormat = pkgs.formats.yaml { };
in
@ -53,13 +58,14 @@ in
};
settings = lib.mkOption {
inherit (settingsFormat) type;
default = { };
defaultText = lib.literalExpression ''
{
server.port = 8080;
}
'';
type = submodule {
freeformType = settingsFormat.type;
options.server.port = mkOption {
type = port;
description = "The port that Komga will listen on.";
default = 8080;
};
};
description = ''
Komga configuration.
@ -87,11 +93,7 @@ in
}
];
services.komga.settings = {
server.port = lib.mkDefault 8080;
};
networking.firewall.allowedTCPPorts = mkIf cfg.openFirewall [ cfg.port ];
networking.firewall.allowedTCPPorts = mkIf cfg.openFirewall [ cfg.settings.server.port ];
users.groups = mkIf (cfg.group == "komga") { komga = { }; };