From 5abcff7ab1598ed4282b79939deedc79a0a149ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=A9clairevoyant?= <848000+eclairevoyant@users.noreply.github.com> Date: Sun, 12 Jan 2025 09:59:35 -0500 Subject: [PATCH] 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 --- nixos/modules/services/web-apps/komga.nix | 28 ++++++++++++----------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/nixos/modules/services/web-apps/komga.nix b/nixos/modules/services/web-apps/komga.nix index 5245552b2130..ed30343f1c07 100644 --- a/nixos/modules/services/web-apps/komga.nix +++ b/nixos/modules/services/web-apps/komga.nix @@ -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 = { }; };