diff options
author | sefidel <contact@sefidel.net> | 2023-12-07 00:03:12 +0900 |
---|---|---|
committer | sefidel <contact@sefidel.net> | 2023-12-07 00:03:12 +0900 |
commit | 2cce1c13214e71611cda133e37cc7b4941e98b2a (patch) | |
tree | f6300c48d0c09147cd084f010693708f61882a15 /modules/services/cinny-web.nix | |
parent | 6bb26431d3fd7696c85b73b3831abf8a89c9be90 (diff) | |
download | infra-2cce1c13214e71611cda133e37cc7b4941e98b2a.tar.gz infra-2cce1c13214e71611cda133e37cc7b4941e98b2a.zip |
feat(modules/{schildichat-web -> cinny-web}): change schildichat-web to cinny-web
Diffstat (limited to 'modules/services/cinny-web.nix')
-rw-r--r-- | modules/services/cinny-web.nix | 34 |
1 files changed, 34 insertions, 0 deletions
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"; + ''; + }; + }; +} |