From 5fb9453d3e900c5b907ba67d9267f06764fadbbd Mon Sep 17 00:00:00 2001 From: sefidel Date: Tue, 4 Apr 2023 22:19:22 +0900 Subject: feat(services/schildichat-web): init --- modules/services/schildichat-web.nix | 47 ++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 modules/services/schildichat-web.nix (limited to 'modules') diff --git a/modules/services/schildichat-web.nix b/modules/services/schildichat-web.nix new file mode 100644 index 0000000..8a8ede5 --- /dev/null +++ b/modules/services/schildichat-web.nix @@ -0,0 +1,47 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + cfg = config.modules.services.schildichat-web; +in +{ + options.modules.services.schildichat-web = { + enable = mkEnableOption "schildichat-web"; + package = mkOption { type = types.package; default = pkgs.schildichat-web; }; + hostName = mkOption { type = types.str; default = config.networking.hostName; }; + matrix = { + baseUrl = mkOption { type = types.str; default = "https://matrix.${config.networking.hostName}"; }; + serverName = mkOption { type = types.str; default = config.networking.hostName; }; + }; + tls.acmeHost = mkOption { type = types.str; default = cfg.hostName; }; + jitsi.domain = mkOption { type = types.str; default = "jitsi.${cfg.hostName}"; }; + }; + + config = mkIf cfg.enable { + services.nginx.virtualHosts.${cfg.hostName} = { + useACMEHost = cfg.tls.acmeHost; + forceSSL = true; + + root = cfg.package.override { + conf = { + default_server_config = { + "m.homeserver" = { + "base_url" = cfg.matrix.baseUrl; + "server_name" = cfg.matrix.serverName; + }; + "m.identity_server" = { + "base_url" = "https://vector.im"; + }; + }; + showLabsSettings = true; + } // optionalAttrs (cfg.jitsi.domain != null) { + jitsi.preferredDomain = cfg.jitsi.domain; + }; + }; + + locations."~ \\.(js|css|woff|woff2?|png|jpe?g|svg)$".extraConfig = '' + add_header Cache-Control "public, max-age=14400, must-revalidate"; + ''; + }; + }; +} -- cgit 1.4.1