Skip to content

Commit aa43b31

Browse files
authored
Merge pull request #723 from NixOS/draupnir
draupnir: migrate from mjolnir
2 parents ee48ece + e58caf3 commit aa43b31

File tree

4 files changed

+87
-49
lines changed

4 files changed

+87
-49
lines changed

non-critical-infra/hosts/caliban/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
inputs.srvos.nixosModules.hardware-hetzner-online-amd
1313
../../../modules/rasdaemon.nix
1414
../../modules/common.nix
15+
../../modules/draupnir.nix
1516
../../modules/first-time-contribution-tagger.nix
1617
../../modules/backup.nix
1718
../../modules/element-web.nix
1819
../../modules/matrix-synapse.nix
19-
../../modules/mjolnir.nix
2020
../../modules/owncast.nix
2121
../../modules/prometheus/node-exporter.nix
2222
../../modules/vaultwarden.nix
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
config,
3+
...
4+
}:
5+
{
6+
sops.secrets.mjolnir-access-token = {
7+
sopsFile = ../secrets/mjolnir-access-token.caliban;
8+
format = "binary";
9+
restartUnits = [ "draupnir.service" ];
10+
};
11+
12+
services.draupnir = {
13+
enable = true;
14+
secrets = {
15+
accessToken = config.sops.secrets.mjolnir-access-token.path;
16+
};
17+
settings = {
18+
# https://github.com/the-draupnir-project/Draupnir/blob/main/config/default.yaml
19+
homeserverUrl = "https://matrix.nixos.org";
20+
managementRoom = "#draupnir:nixos.org";
21+
backgroundDelayMS = "10"; # snappy reactions, we don't mind the performance hit
22+
protectAllJoinedRooms = true;
23+
automaticallyRedactForReasons = [
24+
"spam"
25+
];
26+
web = {
27+
enabled = true;
28+
address = "127.0.0.1";
29+
port = 8082;
30+
abuseReporting.enabled = true;
31+
};
32+
displayReports = true;
33+
};
34+
};
35+
36+
services.nginx.virtualHosts."matrix.nixos.org" = {
37+
# https://github.com/the-draupnir-project/Draupnir/blob/main/test/nginx.conf
38+
locations = {
39+
"~ ^/_matrix/client/(r0|v3)/rooms/([^/\\s]+)/report/(.*)$" = {
40+
extraConfig = ''
41+
mirror /report_mirror;
42+
43+
# Abuse reports should be sent to Draupnir.
44+
# The r0 endpoint is deprecated but still used by many clients.
45+
# As of this writing, the v3 endpoint is the up-to-date version.
46+
47+
# Alias the regexps, to ensure that they're not rewritten.
48+
set $room_id $2;
49+
set $event_id $3;
50+
'';
51+
proxyPass =
52+
with config.services.draupnir.settings.web;
53+
"http://${address}:${toString port}/api/1/report/$room_id/$event_id";
54+
};
55+
"/report_mirror" = {
56+
proxyPass = "http://matrix-synapse$request_uri";
57+
extraConfig = ''
58+
internal;
59+
'';
60+
};
61+
};
62+
};
63+
}

non-critical-infra/modules/mjolnir.nix

Lines changed: 0 additions & 48 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"data": "ENC[AES256_GCM,data:WuqhzFzf9bNkLGljc87P4SJcTLFFjzgfF1AwKTb7ecIW6GgiVp1X8y5ARw==,iv:htfPbSknGVotYObu7FOQhNHPzPttlTAYHeFZragGmsg=,tag:qP4l+RZPywXrupsLr8Vd/g==,type:str]",
3+
"sops": {
4+
"age": [
5+
{
6+
"recipient": "age1sv307kkrxwgjah8pjpap5kzl4j2r6fqr3vg234n7m32chlchs9lsey7nlq",
7+
"enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBkODRUSmNnTVcrUjl1bklF\nSHZaS3NMTmxoK3daQ0FqTXNQaUFPaGpHeVZjCk1ieXdUV0NpbU4rbUhIQlk5N1dS\nZFBtQ05yMHpqOFhKM2dXaU5qL3VXdWMKLS0tIGJFUlc2ell3cTEvQkhFVEg4bVND\nL2ljY3c0ZHVGWVo2MFRGeXZBOWlEWEkKQF46cGAKEXuI1ODorYHHrSeg+slLPPtu\nQ0vOqeK0yJwarsZWaWKCc4+O2cHQP3RNFp4OUcpk/szRo/htM3ZAhw==\n-----END AGE ENCRYPTED FILE-----\n"
8+
},
9+
{
10+
"recipient": "age1j3mkgedmeru63vwww6m44zfw09tg8yw6xdzstaq7ejfkvgcau40qwakm8x",
11+
"enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBqdVJiekRvejhRUnNuTHhy\nZmZ1b1YyenY4d2FNY2lBT0hYWGx0KzVHYVdZCnBueEphS2dTMC9YY0FBQUlwYWNj\ncUFYNERScDlQZDkrQ0ZNb08vNTNGUGMKLS0tIERTelJDZFF5b25FWStRWk5uWkda\nVm1tVGoyNm0rZm5teEt4VEdhL2RmZk0KwamvCxl8D1q8Koet4KIa4laMieqfk4xc\nx+M3xQg/A+OdBRbYhbMvNn3p6PooQljbi1MtTOystOLQEbG+MK6yNg==\n-----END AGE ENCRYPTED FILE-----\n"
12+
},
13+
{
14+
"recipient": "age1jrh8yyq3swjru09s75s4mspu0mphh7h6z54z946raa9wx3pcdegq0x8t4h",
15+
"enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBONzZIeGI0dDF1ajBWVEtu\nWUVRWG5kUHg0YlpDYm9nNVdraXJ6ZnpiaEY0Ck9UOEgwNWtCMVRDWjJmOEQzbUxH\nVDdvby9YUW5USzk5OExZMzRESEVuWlUKLS0tIG9leGZwMG1qb3lCVkJPUm13cGJz\nY1Z5aFVrWWt3aFpXUXkyRmhjV1JJNjQKa3OZQQIQLba4Lto6yaSZtVIxr+rpsO85\nwz1EOKTYvwjDPzLpDbdqUfwDlLkIQ1KAimN2XEqfq1iI87RY7botjw==\n-----END AGE ENCRYPTED FILE-----\n"
16+
}
17+
],
18+
"lastmodified": "2025-06-06T21:23:25Z",
19+
"mac": "ENC[AES256_GCM,data:WrlVzDeD17VtFJLO2sdGDeG8JL536WTl2SDid6jnHSsUZsTqoYCRirzE5ZEKc4aN6DcBPNkuFGVSMVYcmvKq7v5khmW5Oyi0NjT+7hqcewrUAh5loDWzAZd7VOkCsD8GxjtBWtUbADIE2hJ9L8hWoATL9Yh07zwSjWvFg6pW5Bs=,iv:wTOdsNFfdqRluHAFOR1ZcOczYArurlsneqzr8se7SU4=,tag:iiYLrzEuyuuYerNPd9afBA==,type:str]",
20+
"unencrypted_suffix": "_unencrypted",
21+
"version": "3.10.2"
22+
}
23+
}

0 commit comments

Comments
 (0)