Migrated Docker config to nix

This commit is contained in:
2026-04-11 11:36:08 +02:00
parent 104b1cfd38
commit c8bcc35e7c
7 changed files with 114 additions and 12 deletions

View File

@@ -1,6 +1,14 @@
{ pkgs, ... }:
{ pkgs, config, ... }:
let
serverIP = builtins.head (
builtins.match "([0-9.]+)/.*" config.systemd.network.networks."10-ethernet".networkConfig.Address
);
in
{
networking.firewall.allowedTCPPorts = [ 8448 ];
networking.firewall.allowedTCPPorts = [
8448
8080
];
services = {
matrix-synapse = {
@@ -8,6 +16,12 @@
settings = {
server_name = "cyperpunk.de";
public_baseurl = "http://matrix.cyperpunk.de";
enable_registration = false; # TODO: disable
enable_registration_without_verfication = true;
trusted_key_servers = [ { server_name = "matrix.org"; } ];
suppress_key_server_warning = true;
registration_shared_secret_path = config.sops.secrets.matrix_registration_secret.path;
macaroon_secret_key = "$__file{${config.sops.secrets.matrix_macaroon_secret.path}}";
listeners = [
{
port = 8008;
@@ -34,17 +48,33 @@
virtualHosts = {
"matrix.cyperpunk.de" = {
locations."/" = {
proxyPass = "http://127.0.0.1:8008";
proxyPass = "http://127.0.0.1:${toString (builtins.elemAt config.services.matrix-synapse.settings.listeners 0).port}";
proxyWebsockets = true;
extraConfig = ''
proxy_set_header Host matrix.cyperpunk.de;
'';
};
};
"cinny.cyperpunk.de" = {
"cinny" = {
listen = [
{
addr = "0.0.0.0";
port = 8080;
}
];
locations."/" = {
root = pkgs.cinny;
tryFiles = "$uri $uri/ /index.html";
alias = "${pkgs.cinny}/";
extraConfig = ''
try_files $uri $uri/ /index.html;
'';
};
};
"${serverIP}" = {
locations = {
"/_matrix/" = {
proxyPass = "http://127.0.0.1:${toString (builtins.elemAt config.services.matrix-synapse.settings.listeners 0).port}";
proxyWebsockets = true;
};
};
};
};