depot/third_party/nixpkgs/nixos/modules/services/web-apps/guacamole-client.nix
Default email 504525a148 Project import generated by Copybara.
GitOrigin-RevId: bd645e8668ec6612439a9ee7e71f7eac4099d4f6
2024-01-02 12:29:13 +01:00

60 lines
1.6 KiB
Nix

{ config
, lib
, pkgs
, ...
}:
let
cfg = config.services.guacamole-client;
settingsFormat = pkgs.formats.javaProperties { };
in
{
options = {
services.guacamole-client = {
enable = lib.mkEnableOption (lib.mdDoc "Apache Guacamole Client (Tomcat)");
package = lib.mkPackageOption pkgs "guacamole-client" { };
settings = lib.mkOption {
type = lib.types.submodule {
freeformType = settingsFormat.type;
};
default = {
guacd-hostname = "localhost";
guacd-port = 4822;
};
description = lib.mdDoc ''
Configuration written to `guacamole.properties`.
::: {.note}
The Guacamole web application uses one main configuration file called
`guacamole.properties`. This file is the common location for all
configuration properties read by Guacamole or any extension of
Guacamole, including authentication providers.
:::
'';
};
enableWebserver = lib.mkOption {
type = lib.types.bool;
default = true;
description = lib.mdDoc ''
Enable the Guacamole web application in a Tomcat webserver.
'';
};
};
};
config = lib.mkIf cfg.enable {
environment.etc."guacamole/guacamole.properties" = lib.mkIf
(cfg.settings != {})
{ source = (settingsFormat.generate "guacamole.properties" cfg.settings); };
services = lib.mkIf cfg.enableWebserver {
tomcat = {
enable = true;
webapps = [
cfg.package
];
};
};
};
}