mirror of
https://git.pvv.ntnu.no/Drift/pvv-nixos-config.git
synced 2026-02-04 09:10:01 +01:00
bicep/matrix: add module for adding stuff to well-known
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
./element.nix
|
||||
./coturn.nix
|
||||
./mjolnir.nix
|
||||
./well-known.nix
|
||||
|
||||
# ./discord.nix
|
||||
./out-of-your-element.nix
|
||||
|
||||
@@ -2,6 +2,13 @@
|
||||
let
|
||||
synapse-cfg = config.services.matrix-synapse-next;
|
||||
in {
|
||||
services.pvv-matrix-well-known.client = {
|
||||
"m.homeserver" = {
|
||||
base_url = "https://matrix.pvv.ntnu.no";
|
||||
server_name = "pvv.ntnu.no";
|
||||
};
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."chat.pvv.ntnu.no" = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
|
||||
@@ -132,21 +132,12 @@ in {
|
||||
|
||||
services.redis.servers."".enable = true;
|
||||
|
||||
services.pvv-matrix-well-known.server."m.server" = "matrix.pvv.ntnu.no:443";
|
||||
|
||||
services.nginx.virtualHosts."matrix.pvv.ntnu.no" = lib.mkMerge [
|
||||
{
|
||||
kTLS = true;
|
||||
}
|
||||
{
|
||||
locations."/.well-known/matrix/server" = {
|
||||
return = ''
|
||||
200 '{"m.server": "matrix.pvv.ntnu.no:443"}'
|
||||
'';
|
||||
extraConfig = ''
|
||||
default_type application/json;
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
'';
|
||||
};
|
||||
}
|
||||
{
|
||||
locations."/_synapse/admin" = {
|
||||
proxyPass = "http://$synapse_backend";
|
||||
|
||||
44
hosts/bicep/services/matrix/well-known.nix
Normal file
44
hosts/bicep/services/matrix/well-known.nix
Normal file
@@ -0,0 +1,44 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
cfg = config.services.pvv-matrix-well-known;
|
||||
format = pkgs.formats.json { };
|
||||
matrixDomain = "matrix.pvv.ntnu.no";
|
||||
in
|
||||
{
|
||||
options.services.pvv-matrix-well-known = {
|
||||
client = lib.mkOption {
|
||||
type = lib.types.submodule { freeformType = format.type; };
|
||||
default = { };
|
||||
example = {
|
||||
"m.homeserver".base_url = "https://${matrixDomain}/";
|
||||
};
|
||||
};
|
||||
|
||||
server = lib.mkOption {
|
||||
type = lib.types.submodule { freeformType = format.type; };
|
||||
default = { };
|
||||
example = {
|
||||
"m.server" = "https://${matrixDomain}/";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
services.nginx.virtualHosts.${matrixDomain} = {
|
||||
locations."= /.well-known/matrix/client" = lib.mkIf (cfg.client != { }) {
|
||||
alias = format.generate "nginx-well-known-matrix-server.json" cfg.client;
|
||||
extraConfig = ''
|
||||
default_type application/json;
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
'';
|
||||
};
|
||||
locations."= /.well-known/matrix/server" = lib.mkIf (cfg.server != { }) {
|
||||
alias = format.generate "nginx-well-known-matrix-server.json" cfg.server;
|
||||
extraConfig = ''
|
||||
default_type application/json;
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user