forked from fabian/nix_config
unified all nixos configurations
This commit is contained in:
parent
001642dc94
commit
42530f5cfc
32 changed files with 1054 additions and 56 deletions
58
sys/platforms/vps/srv/matrix.nix
Normal file
58
sys/platforms/vps/srv/matrix.nix
Normal file
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
flakes,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
subdomain = "matrix.posixlycorrect.com";
|
||||
baseUrl = "https://${subdomain}";
|
||||
in {
|
||||
# ver https://nixos.org/manual/nixos/stable/#module-services-matrix
|
||||
services = {
|
||||
matrix-conduit = {
|
||||
enable = true;
|
||||
package = flakes.conduwuit.packages.${pkgs.system}.default;
|
||||
settings.global = {
|
||||
address = "::1";
|
||||
port = 6167;
|
||||
allow_encryption = true;
|
||||
allow_federation = true;
|
||||
allow_registration = false;
|
||||
database_backend = "rocksdb";
|
||||
server_name = "posixlycorrect.com";
|
||||
allow_check_for_updates = true;
|
||||
new_user_displayname_suffix = "";
|
||||
};
|
||||
};
|
||||
|
||||
nginx.virtualHosts = let
|
||||
clientConfig."m.homeserver".base_url = baseUrl;
|
||||
serverConfig."m.server" = "${subdomain}:443";
|
||||
mkWellKnown = data: ''
|
||||
default_type application/json;
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
return 200 '${builtins.toJSON data}';
|
||||
'';
|
||||
in {
|
||||
"posixlycorrect.com" = {
|
||||
locations."= /.well-known/matrix/server".extraConfig = mkWellKnown serverConfig;
|
||||
locations."= /.well-known/matrix/client".extraConfig = mkWellKnown clientConfig;
|
||||
};
|
||||
"${subdomain}" = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
extraConfig = ''
|
||||
proxy_headers_hash_max_size 512;
|
||||
proxy_headers_hash_bucket_size 128;
|
||||
'';
|
||||
locations."/".extraConfig = ''
|
||||
return 403;
|
||||
'';
|
||||
locations."/_matrix".proxyPass = "http://[::1]:6167";
|
||||
locations."/_synapse/client".proxyPass = "http://[::1]:6167";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue