7 cfg = config.services.guacamole-server;
11 services.guacamole-server = {
12 enable = lib.mkEnableOption "Apache Guacamole Server (guacd)";
13 package = lib.mkPackageOption pkgs "guacamole-server" { };
15 extraEnvironment = lib.mkOption {
16 type = lib.types.attrsOf lib.types.str;
18 example = lib.literalExpression ''
20 ENVIRONMENT = "production";
23 description = "Environment variables to pass to guacd.";
27 default = "127.0.0.1";
29 The host name or IP address the server should listen to.
37 The port the guacd server should listen to.
39 type = lib.types.port;
42 logbackXml = lib.mkOption {
43 type = lib.types.nullOr lib.types.path;
45 example = "/path/to/logback.xml";
47 Configuration file that correspond to `logback.xml`.
51 userMappingXml = lib.mkOption {
52 type = lib.types.nullOr lib.types.path;
54 example = "/path/to/user-mapping.xml";
56 Configuration file that correspond to `user-mapping.xml`.
62 config = lib.mkIf cfg.enable {
63 # Setup configuration files.
64 environment.etc."guacamole/logback.xml" = lib.mkIf (cfg.logbackXml != null) { source = cfg.logbackXml; };
65 environment.etc."guacamole/user-mapping.xml" = lib.mkIf (cfg.userMappingXml != null) { source = cfg.userMappingXml; };
67 systemd.services.guacamole-server = {
68 description = "Apache Guacamole server (guacd)";
69 wantedBy = [ "multi-user.target" ];
70 after = [ "network.target" ];
72 HOME = "/run/guacamole-server";
73 } // cfg.extraEnvironment;
75 ExecStart = "${lib.getExe cfg.package} -f -b ${cfg.host} -l ${toString cfg.port}";
76 RuntimeDirectory = "guacamole-server";
79 Restart = "on-failure";