From 598f6dd4fc046410bb2719227d5d48e927e7d39b Mon Sep 17 00:00:00 2001 From: Vanilla Date: Mon, 17 Nov 2025 14:11:28 +0800 Subject: [PATCH] nixos/guacamole: client option defined in server module --- .../services/web-apps/guacamole-client.nix | 25 +++++++++++++ .../services/web-apps/guacamole-server.nix | 36 ++++++------------- 2 files changed, 35 insertions(+), 26 deletions(-) diff --git a/nixos/modules/services/web-apps/guacamole-client.nix b/nixos/modules/services/web-apps/guacamole-client.nix index e263526e8c55..54ca2f4f3be7 100644 --- a/nixos/modules/services/web-apps/guacamole-client.nix +++ b/nixos/modules/services/web-apps/guacamole-client.nix @@ -41,13 +41,38 @@ in Enable the Guacamole web application in a Tomcat webserver. ''; }; + + logbackXml = lib.mkOption { + type = lib.types.nullOr lib.types.path; + default = null; + example = "/path/to/logback.xml"; + description = '' + Configuration file that correspond to `logback.xml`. + ''; + }; + + userMappingXml = lib.mkOption { + type = lib.types.nullOr lib.types.path; + default = null; + example = "/path/to/user-mapping.xml"; + description = '' + Configuration file that correspond to `user-mapping.xml`. + ''; + }; }; }; config = lib.mkIf cfg.enable { + # Setup configuration files. environment.etc."guacamole/guacamole.properties" = lib.mkIf (cfg.settings != { }) { source = (settingsFormat.generate "guacamole.properties" cfg.settings); }; + environment.etc."guacamole/logback.xml" = lib.mkIf (cfg.logbackXml != null) { + source = cfg.logbackXml; + }; + environment.etc."guacamole/user-mapping.xml" = lib.mkIf (cfg.userMappingXml != null) { + source = cfg.userMappingXml; + }; services = lib.mkIf cfg.enableWebserver { tomcat = { diff --git a/nixos/modules/services/web-apps/guacamole-server.nix b/nixos/modules/services/web-apps/guacamole-server.nix index 79a90fe7df60..2c20247ec3d9 100644 --- a/nixos/modules/services/web-apps/guacamole-server.nix +++ b/nixos/modules/services/web-apps/guacamole-server.nix @@ -8,6 +8,16 @@ let cfg = config.services.guacamole-server; in { + imports = [ + (lib.mkRenamedOptionModule + [ "services" "guacamole-server" "logbackXml" ] + [ "services" "guacamole-client" "logbackXml" ] + ) + (lib.mkRenamedOptionModule + [ "services" "guacamole-server" "userMappingXml" ] + [ "services" "guacamole-client" "userMappingXml" ] + ) + ]; options = { services.guacamole-server = { enable = lib.mkEnableOption "Apache Guacamole Server (guacd)"; @@ -39,36 +49,10 @@ in ''; type = lib.types.port; }; - - logbackXml = lib.mkOption { - type = lib.types.nullOr lib.types.path; - default = null; - example = "/path/to/logback.xml"; - description = '' - Configuration file that correspond to `logback.xml`. - ''; - }; - - userMappingXml = lib.mkOption { - type = lib.types.nullOr lib.types.path; - default = null; - example = "/path/to/user-mapping.xml"; - description = '' - Configuration file that correspond to `user-mapping.xml`. - ''; - }; }; }; config = lib.mkIf cfg.enable { - # Setup configuration files. - environment.etc."guacamole/logback.xml" = lib.mkIf (cfg.logbackXml != null) { - source = cfg.logbackXml; - }; - environment.etc."guacamole/user-mapping.xml" = lib.mkIf (cfg.userMappingXml != null) { - source = cfg.userMappingXml; - }; - systemd.services.guacamole-server = { description = "Apache Guacamole server (guacd)"; wantedBy = [ "multi-user.target" ];