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