💬 matrix-synapse server

This commit is contained in:
James Walker 2021-06-07 21:15:08 -04:00
parent 74ea9cd3ce
commit 9fa26478eb
Signed by: walkah
GPG Key ID: 3C127179D6086E93
4 changed files with 75 additions and 6 deletions

View File

@ -9,6 +9,7 @@ in {
<home-manager/nixos>
../../modules/coredns
../../modules/matrix
];
# Use the systemd-boot EFI boot loader.
@ -47,7 +48,7 @@ in {
home-manager.users.walkah = import "${dotfiles}/home.nix";
system.autoUpgrade.enable = true;
environment.systemPackages = with pkgs; [ ];
environment.systemPackages = with pkgs; [ weechat ];
fileSystems."/mnt/downloads" = {
device = "192.168.6.100:/volume1/Downloads";
@ -63,8 +64,10 @@ in {
};
programs.mosh.enable = true;
programs.zsh.enable = true;
programs.zsh = {
enable = true;
promptInit = "";
};
# Enable the OpenSSH daemon.
services.openssh.enable = true;

View File

@ -8,6 +8,8 @@ in {
./hardware-configuration.nix
./networking.nix # generated at runtime by nixos-infect
<home-manager/nixos>
../../modules/matrix/nginx.nix
];
boot.cleanTmpDir = true;
@ -39,7 +41,7 @@ in {
};
home-manager.users.walkah = import "${dotfiles}/home.nix";
system.autoUpgrade.enable = true;
system.autoUpgrade.enable = false;
environment.systemPackages = with pkgs; [ ];
programs.mosh.enable = true;
@ -53,9 +55,10 @@ in {
services.nginx = {
enable = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
recommendedOptimisation = true;
recommendedGzipSettings = true;
recommendedProxySettings = true;
};
}

View File

@ -0,0 +1,37 @@
{ config, lib, pkgs, ... }:
{
services = {
postgresql = {
enable = true;
initialScript = pkgs.writeText "synapse-init.sql" ''
CREATE ROLE "matrix-synapse";
CREATE DATABASE "matrix" WITH OWNER "matrix-synapse"
TEMPLATE template0
ENCODING 'UTF8'
LC_COLLATE = "C"
LC_CTYPE = "C";
'';
};
matrix-synapse = {
enable = true;
server_name = "walkah.chat";
enable_metrics = true;
enable_registration = false;
database_type = "psycopg2";
database_args = { database = "matrix"; };
listeners = [{
port = 8008;
type = "http";
tls = false;
x_forwarded = true;
resources = [{
compress = false;
names = [ "client" "federation" ];
}];
}];
};
};
}

26
modules/matrix/nginx.nix Normal file
View File

@ -0,0 +1,26 @@
{ config, lib, pkgs, ... }:
{
services.nginx = {
enable = true;
virtualHosts = {
"matrix.walkah.chat" = {
forceSSL = true;
enableACME = true;
locations."/" = { proxyPass = "http://plato:8008"; };
};
"walkah.chat" = {
forceSSL = true;
enableACME = true;
locations."= /.well-known/matrix/server".extraConfig =
let server = { "m.server" = "matrix.walkah.chat:443"; };
in ''
add_header Content-Type application/json;
return 200 '${builtins.toJSON server}';
'';
locations."/" = { root = pkgs.element-web; };
};
};
};
}