nixos/guacamole: client option defined in server module

This commit is contained in:
Vanilla 2025-11-17 14:11:28 +08:00
commit 598f6dd4fc
No known key found for this signature in database
GPG key ID: 3750028ED04FA42E
2 changed files with 35 additions and 26 deletions

View file

@ -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 = {

View file

@ -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" ];