Unverified Commit b0aa231d authored by Aleksana's avatar Aleksana Committed by GitHub
Browse files

nixos/guacamole: client option defined in server module (#462487)

parents 9e24be80 598f6dd4
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -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 = {
+10 −26
Original line number Diff line number Diff line
@@ -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" ];