This commit is contained in:
XenGi 2025-12-02 19:36:46 +01:00
parent 63f434567a
commit 04efe82c0a
Signed by: xengi
SSH key fingerprint: SHA256:dM+fLZGsDvyv6kunjE8bGduL24VsCFB4LEOSdmRHdG0
10 changed files with 60 additions and 18 deletions

13
.editorconfig Normal file
View file

@ -0,0 +1,13 @@
# EditorConfig is awesome: https://editorconfig.org
root = true
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
[*.nix]
indent_style = space
indent_size = 2

View file

@ -17,14 +17,15 @@
settings = { settings = {
auto-optimise-store = true; auto-optimise-store = true;
sandbox = false; sandbox = false;
# Allow remote updates
trusted-users = [ trusted-users = [
"root" "root"
"@wheel" "@wheel"
]; # Allow remote updates ];
experimental-features = [ experimental-features = [
"nix-command" "nix-command"
"flakes" "flakes"
]; # Enable flakes ];
}; };
gc = { gc = {
automatic = true; automatic = true;

View file

@ -34,6 +34,7 @@
nixosConfigurations."matrix" = nixpkgs.lib.nixosSystem { nixosConfigurations."matrix" = nixpkgs.lib.nixosSystem {
#system = "x86_64-linux"; #system = "x86_64-linux";
#pkgs = import nixpkgs { inherit system; }; #pkgs = import nixpkgs { inherit system; };
inherit system;
modules = [ modules = [
agenix.nixosModules.default agenix.nixosModules.default
{ environment.systemPackages = [ (agenix.packages.${system}.default) ]; } { environment.systemPackages = [ (agenix.packages.${system}.default) ]; }

View file

@ -17,7 +17,7 @@ let
_matrix = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM7AZkepRXoY+DJeSLOU+GR60S62p6+0X/PDeEUZ0yHx root@matrix"; _matrix = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM7AZkepRXoY+DJeSLOU+GR60S62p6+0X/PDeEUZ0yHx root@matrix";
in in
{ {
"matrix-registration-shared-secret.age".publicKeys = users ++ [ _matrix ]; "matrix_registration_shared_secret.age".publicKeys = users ++ [ _matrix ];
"pushover_app_token.age".publicKeys = users ++ [ _matrix ]; "pushover_app_token.age".publicKeys = users ++ [ _matrix ];
"pushover_user_key.age".publicKeys = users ++ [ _matrix ]; "pushover_user_key.age".publicKeys = users ++ [ _matrix ];
} }

View file

@ -5,7 +5,7 @@
enable = false; enable = false;
settings = { settings = {
homeserverUrl = "https://matrix.berlin.ccc.de"; homeserverUrl = "https://matrix.berlin.ccc.de";
managementRoom = "#moderators:berlin.ccc.de"; managementRoom = "!ZYWNuaQBkkenNklCSm:matrix.org"; # #cccb-moderators:berlin.ccc.de
autojoinOnlyIfManager = true; autojoinOnlyIfManager = true;
recordIgnoredInvites = true; recordIgnoredInvites = true;
roomStateBackingStore.enabled = true; roomStateBackingStore.enabled = true;
@ -14,4 +14,3 @@
secrets.accessToken = config.age.secrets.draupnir_access_token.path; secrets.accessToken = config.age.secrets.draupnir_access_token.path;
}; };
} }

View file

@ -1,4 +1,4 @@
{ ... }: { config, ... }:
# Dashboards: # Dashboards:
# - Synapse: https://github.com/element-hq/synapse/tree/master/contrib/grafana # - Synapse: https://github.com/element-hq/synapse/tree/master/contrib/grafana
@ -56,4 +56,3 @@
}; };
}; };
} }

View file

@ -7,7 +7,12 @@ in
services.nginx = { services.nginx = {
enable = true; enable = true;
package = pkgs.nginxQuic; package = pkgs.nginxQuic;
resolver.addresses = ["[2606:4700:4700::1111]" "[2620:fe::fe]" "1.1.1.1" "9.9.9.9"]; resolver.addresses = [
"[2606:4700:4700::1111]"
"[2620:fe::fe]"
"1.1.1.1"
"9.9.9.9"
];
statusPage = true; # http://127.0.0.1/nginx_status statusPage = true; # http://127.0.0.1/nginx_status
sslProtocols = "TLSv1.3"; sslProtocols = "TLSv1.3";
recommendedTlsSettings = true; recommendedTlsSettings = true;
@ -20,6 +25,28 @@ in
kTLS = true; kTLS = true;
forceSSL = true; forceSSL = true;
useACMEHost = fqdn; useACMEHost = fqdn;
listen = [
{
addr = "0.0.0.0";
port = 443;
ssl = true;
}
{
addr = "::";
port = 443;
ssl = true;
}
{
addr = "0.0.0.0";
port = 8448;
ssl = true;
}
{
addr = "::";
port = 8448;
ssl = true;
}
];
locations = { locations = {
"/".return = "418 \"I'm a Teapot!\""; "/".return = "418 \"I'm a Teapot!\"";
"= /.well-known/matrix/client" = { "= /.well-known/matrix/client" = {
@ -29,7 +56,7 @@ in
add_header Access-Control-Allow-Origin "*"; add_header Access-Control-Allow-Origin "*";
''; '';
}; };
"~ ^(/_matrix|/_synapse/client)" { "~ ^(/_matrix|/_synapse/client)" = {
recommendedProxySettings = true; recommendedProxySettings = true;
proxyPass = "http://[::1]:8008"; proxyPass = "http://[::1]:8008";
extraConfig = '' extraConfig = ''
@ -42,5 +69,5 @@ in
}; };
}; };
security.acme.certs."${fqdn}".reloadServices = ["nginx"]; security.acme.certs."${fqdn}".reloadServices = [ "nginx" ];
} }

View file

@ -12,11 +12,11 @@
}; };
scrapeConfigs = [ scrapeConfigs = [
{ {
job_name = "synapse"; job_name = "synapse";
scrape_interval = "15s"; scrape_interval = "15s";
static_configs = [ static_configs = [
{ {
targets = ["[::1]:9009"]; targets = [ "[::1]:9009" ];
} }
]; ];
} }
@ -63,4 +63,3 @@
]; ];
}; };
} }

View file

@ -25,6 +25,7 @@ in
tls = false; tls = false;
port = 8008; port = 8008;
bind_addresses = [ "::1" ]; bind_addresses = [ "::1" ];
#request_id_header = "X-Request-ID";
resources = [ resources = [
{ {
compress = false; compress = false;
@ -39,10 +40,12 @@ in
type = "metrics"; type = "metrics";
port = 9009; port = 9009;
bind_addresses = [ "::1" ]; bind_addresses = [ "::1" ];
resources = [{ resources = [
compress = false; {
names = [ "metrics" ]; compress = false;
}]; names = [ "metrics" ];
}
];
} }
]; ];
enable_metrics = true; enable_metrics = true;
@ -61,7 +64,7 @@ in
}; };
}; };
extraConfigFiles = [ extraConfigFiles = [
config.age.secrets.matrix-registration-shared-secret.path config.age.secrets.matrix_registration_shared_secret.path
]; ];
enableRegistrationScript = true; enableRegistrationScript = true;
}; };