mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 19:55:41 +03:00

After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
88 lines
2.3 KiB
Nix
88 lines
2.3 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.services.guacamole-server;
|
|
in
|
|
{
|
|
options = {
|
|
services.guacamole-server = {
|
|
enable = lib.mkEnableOption "Apache Guacamole Server (guacd)";
|
|
package = lib.mkPackageOption pkgs "guacamole-server" { };
|
|
|
|
extraEnvironment = lib.mkOption {
|
|
type = lib.types.attrsOf lib.types.str;
|
|
default = { };
|
|
example = lib.literalExpression ''
|
|
{
|
|
ENVIRONMENT = "production";
|
|
}
|
|
'';
|
|
description = "Environment variables to pass to guacd.";
|
|
};
|
|
|
|
host = lib.mkOption {
|
|
default = "127.0.0.1";
|
|
description = ''
|
|
The host name or IP address the server should listen to.
|
|
'';
|
|
type = lib.types.str;
|
|
};
|
|
|
|
port = lib.mkOption {
|
|
default = 4822;
|
|
description = ''
|
|
The port the guacd server should listen to.
|
|
'';
|
|
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" ];
|
|
after = [ "network.target" ];
|
|
environment = {
|
|
HOME = "/run/guacamole-server";
|
|
} // cfg.extraEnvironment;
|
|
serviceConfig = {
|
|
ExecStart = "${lib.getExe cfg.package} -f -b ${cfg.host} -l ${toString cfg.port}";
|
|
RuntimeDirectory = "guacamole-server";
|
|
DynamicUser = true;
|
|
PrivateTmp = "yes";
|
|
Restart = "on-failure";
|
|
};
|
|
};
|
|
};
|
|
}
|