From 2cce1c13214e71611cda133e37cc7b4941e98b2a Mon Sep 17 00:00:00 2001 From: sefidel Date: Thu, 7 Dec 2023 00:03:12 +0900 Subject: feat(modules/{schildichat-web -> cinny-web}): change schildichat-web to cinny-web --- modules/services/cinny-web.nix | 34 ++++++++++++++++++++++++++ modules/services/schildichat-web.nix | 47 ------------------------------------ systems/cobalt/default.nix | 12 +++------ 3 files changed, 38 insertions(+), 55 deletions(-) create mode 100644 modules/services/cinny-web.nix delete mode 100644 modules/services/schildichat-web.nix diff --git a/modules/services/cinny-web.nix b/modules/services/cinny-web.nix new file mode 100644 index 0000000..e796ff8 --- /dev/null +++ b/modules/services/cinny-web.nix @@ -0,0 +1,34 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + cfg = config.modules.services.cinny-web; +in +{ + options.modules.services.cinny-web = { + enable = mkEnableOption "cinny-web"; + package = mkOption { type = types.package; default = pkgs.cinny; }; + hostName = mkOption { type = types.str; default = config.networking.hostName; }; + matrix.serverName = mkOption { type = types.str; default = config.networking.hostName; }; + tls.acmeHost = mkOption { type = types.str; default = cfg.hostName; }; + }; + + config = mkIf cfg.enable { + services.nginx.virtualHosts.${cfg.hostName} = { + useACMEHost = cfg.tls.acmeHost; + forceSSL = true; + + root = cfg.package.override { + conf = { + # Index of the default homeserver from `homeserverList` + defaultHomeserver = 0; + homeserverList = [ cfg.matrix.serverName ]; + }; + }; + + locations."~ \\.(js|css|woff|woff2?|png|jpe?g|svg)$".extraConfig = '' + add_header Cache-Control "public, max-age=14400, must-revalidate"; + ''; + }; + }; +} diff --git a/modules/services/schildichat-web.nix b/modules/services/schildichat-web.nix deleted file mode 100644 index 8a8ede5..0000000 --- a/modules/services/schildichat-web.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ 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"; - ''; - }; - }; -} diff --git a/systems/cobalt/default.nix b/systems/cobalt/default.nix index 05f75d3..c828c27 100644 --- a/systems/cobalt/default.nix +++ b/systems/cobalt/default.nix @@ -223,7 +223,7 @@ in "bouncer" "meet" "chat" - "schildi" + "cinny" "turn" "status" "mail" @@ -300,15 +300,11 @@ in tls.acmeHost = "exotic.sh"; jitsi.domain = "meet.exotic.sh"; }; - services.schildichat-web = { + services.cinny-web = { enable = true; - hostName = "schildi.exotic.sh"; - matrix = { - baseUrl = config.modules.services.element-web.matrix.baseUrl; - serverName = config.modules.services.element-web.matrix.serverName; - }; + hostName = "cinny.exotic.sh"; + matrix.serverName = config.modules.services.element-web.matrix.serverName; tls.acmeHost = config.modules.services.element-web.tls.acmeHost; - jitsi.domain = config.modules.services.element-web.jitsi.domain; }; services.akkoma = { enable = true; -- cgit 1.4.1