aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2024-08-23 22:19:24 +0900
committersefidel <contact@sefidel.net>2024-08-23 22:19:24 +0900
commit392b93043850e9f3392b79f4ec5a4ac06debd849 (patch)
tree45975445bbc93bfcb94da55bd402b132981a53d2
parent871a7ff47b9c1e374886ea44de92b5f48db1f03f (diff)
downloadinfra-392b93043850e9f3392b79f4ec5a4ac06debd849.zip
feat(modules/hydrogen-web): init
-rw-r--r--modules/services/hydrogen-web.nix36
1 files changed, 36 insertions, 0 deletions
diff --git a/modules/services/hydrogen-web.nix b/modules/services/hydrogen-web.nix
new file mode 100644
index 0000000..b19c516
--- /dev/null
+++ b/modules/services/hydrogen-web.nix
@@ -0,0 +1,36 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+let
+ cfg = config.modules.services.hydrogen-web;
+in
+{
+ options.modules.services.hydrogen-web = {
+ enable = mkEnableOption "hydrogen-web";
+ package = mkOption { type = types.package; default = pkgs.hydrogen-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 = {
+ defaultHomeServer = cfg.matrix.serverName;
+ };
+ };
+
+ locations."~ \\.(js|css|woff|woff2?|png|jpe?g|svg)$".extraConfig = ''
+ add_header Cache-Control "public, max-age=14400, must-revalidate";
+ '';
+ };
+ };
+}