Compare commits
4 Commits
f5c16f46f1
...
2c86a2d812
Author | SHA1 | Date |
---|---|---|
Daniel Lovbrotte Olsen | 2c86a2d812 | |
Daniel Lovbrotte Olsen | d4fd3f8332 | |
Joakim Pettersvold | c1833eb07c | |
Finn Landweber | 5ee23ef2e2 |
|
@ -57,7 +57,7 @@
|
||||||
rec {
|
rec {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit nixpkgs-unstable inputs;
|
inherit unstablePkgs inputs;
|
||||||
values = import ./values.nix;
|
values = import ./values.nix;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
./mjolnir.nix
|
./mjolnir.nix
|
||||||
|
|
||||||
./discord.nix
|
./discord.nix
|
||||||
|
./hookshot
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,103 @@
|
||||||
|
{ config, lib, unstablePkgs, inputs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.services.matrix-hookshot;
|
||||||
|
webhookListenAddress = "127.0.0.1";
|
||||||
|
webhookListenPort = 8435;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./module.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
sops.secrets."matrix/registrations/matrix-hookshot" = {
|
||||||
|
sopsFile = ../../../../../secrets/bicep/matrix.yaml;
|
||||||
|
key = "registrations/matrix-hookshot";
|
||||||
|
owner = config.users.users.matrix-synapse.name;
|
||||||
|
group = config.users.groups.keys-matrix-registrations.name;
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.matrix-hookshot = {
|
||||||
|
serviceConfig.SupplementaryGroups = [ config.users.groups.keys-matrix-registrations.name ];
|
||||||
|
};
|
||||||
|
|
||||||
|
services.matrix-hookshot = {
|
||||||
|
enable = true;
|
||||||
|
package = unstablePkgs.matrix-hookshot;
|
||||||
|
registrationFile = config.sops.secrets."matrix/registrations/matrix-hookshot".path;
|
||||||
|
settings = {
|
||||||
|
bridge = {
|
||||||
|
bindAddress = "127.0.0.1";
|
||||||
|
domain = "pvv.ntnu.no";
|
||||||
|
url = "https://matrix.pvv.ntnu.no";
|
||||||
|
mediaUrl = "https://matrix.pvv.ntnu.no";
|
||||||
|
port = 9993;
|
||||||
|
};
|
||||||
|
listeners = [
|
||||||
|
{
|
||||||
|
bindAddress = webhookListenAddress;
|
||||||
|
port = webhookListenPort;
|
||||||
|
resources = [
|
||||||
|
"webhooks"
|
||||||
|
# "metrics"
|
||||||
|
# "provisioning"
|
||||||
|
"widgets"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
generic = {
|
||||||
|
enabled = true;
|
||||||
|
outbound = true;
|
||||||
|
urlPrefix = "https://hookshot.pvv.ntnu.no/webhook/";
|
||||||
|
userIdPrefix = "_webhooks_";
|
||||||
|
allowJsTransformationFunctions = false;
|
||||||
|
waitForComplete = false;
|
||||||
|
};
|
||||||
|
feeds = {
|
||||||
|
enabled = true;
|
||||||
|
pollIntervalSeconds = 600;
|
||||||
|
};
|
||||||
|
|
||||||
|
serviceBots = [
|
||||||
|
{ localpart = "bot_feeds";
|
||||||
|
displayname = "Aya";
|
||||||
|
avatar = ./feeds.png;
|
||||||
|
prefix = "!aya";
|
||||||
|
service = "feeds";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
permissions = [
|
||||||
|
# Users of the PVV Server
|
||||||
|
{ actor = "pvv.ntnu.no";
|
||||||
|
services = [ { service = "*"; level = "commands"; } ];
|
||||||
|
}
|
||||||
|
# Members of Medlem space (for people with their own hs)
|
||||||
|
{ actor = "!pZOTJQinWyyTWaeOgK:pvv.ntnu.no";
|
||||||
|
services = [ { service = "*"; level = "commands"; } ];
|
||||||
|
}
|
||||||
|
# Members of Drift
|
||||||
|
{ actor = "!eYgeufLrninXxQpYml:pvv.ntnu.no";
|
||||||
|
services = [ { service = "*"; level = "admin"; } ];
|
||||||
|
}
|
||||||
|
# Dan bootstrap
|
||||||
|
{ actor = "@dandellion:dodsorf.as";
|
||||||
|
services = [ { service = "*"; level = "admin"; } ];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.matrix-hookshot.serviceDependencies = [ "matrix-synapse.target" "nginx.service" ];
|
||||||
|
|
||||||
|
services.matrix-synapse-next.settings = {
|
||||||
|
app_service_config_files = [ config.sops.secrets."matrix/registrations/matrix-hookshot".path ];
|
||||||
|
};
|
||||||
|
|
||||||
|
services.nginx.virtualHosts."hookshot.pvv.ntnu.no" = {
|
||||||
|
enableACME = true;
|
||||||
|
locations."/" = {
|
||||||
|
proxyPass = "http://${webhookListenAddress}:${toString webhookListenPort}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 1.1 MiB |
|
@ -0,0 +1,127 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.services.matrix-hookshot;
|
||||||
|
settingsFormat = pkgs.formats.yaml { };
|
||||||
|
configFile = settingsFormat.generate "matrix-hookshot-config.yml" cfg.settings;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
services.matrix-hookshot = {
|
||||||
|
enable = lib.mkEnableOption "matrix-hookshot, a bridge between Matrix and project management services";
|
||||||
|
|
||||||
|
package = lib.mkPackageOption pkgs "matrix-hookshot" { };
|
||||||
|
|
||||||
|
registrationFile = lib.mkOption {
|
||||||
|
type = lib.types.path;
|
||||||
|
description = ''
|
||||||
|
Appservice registration file.
|
||||||
|
As it contains secret tokens, you may not want to add this to the publicly readable Nix store.
|
||||||
|
'';
|
||||||
|
example = lib.literalExpression ''
|
||||||
|
pkgs.writeText "matrix-hookshot-registration" \'\'
|
||||||
|
id: matrix-hookshot
|
||||||
|
as_token: aaaaaaaaaa
|
||||||
|
hs_token: aaaaaaaaaa
|
||||||
|
namespaces:
|
||||||
|
rooms: []
|
||||||
|
users:
|
||||||
|
- regex: "@_webhooks_.*:foobar"
|
||||||
|
exclusive: true
|
||||||
|
|
||||||
|
sender_localpart: hookshot
|
||||||
|
url: "http://localhost:9993"
|
||||||
|
rate_limited: false
|
||||||
|
\'\'
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
settings = lib.mkOption {
|
||||||
|
description = ''
|
||||||
|
{file}`config.yml` configuration as a Nix attribute set.
|
||||||
|
|
||||||
|
For details please see the [documentation](https://matrix-org.github.io/matrix-hookshot/latest/setup/sample-configuration.html).
|
||||||
|
'';
|
||||||
|
example = {
|
||||||
|
bridge = {
|
||||||
|
domain = "example.com";
|
||||||
|
url = "http://localhost:8008";
|
||||||
|
mediaUrl = "https://example.com";
|
||||||
|
port = 9993;
|
||||||
|
bindAddress = "127.0.0.1";
|
||||||
|
};
|
||||||
|
listeners = [
|
||||||
|
{
|
||||||
|
port = 9000;
|
||||||
|
bindAddress = "0.0.0.0";
|
||||||
|
resources = [ "webhooks" ];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
port = 9001;
|
||||||
|
bindAddress = "localhost";
|
||||||
|
resources = [
|
||||||
|
"metrics"
|
||||||
|
"provisioning"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
default = { };
|
||||||
|
type = lib.types.submodule {
|
||||||
|
freeformType = settingsFormat.type;
|
||||||
|
options = {
|
||||||
|
passFile = lib.mkOption {
|
||||||
|
type = lib.types.path;
|
||||||
|
default = "/var/lib/matrix-hookshot/passkey.pem";
|
||||||
|
description = ''
|
||||||
|
A passkey used to encrypt tokens stored inside the bridge.
|
||||||
|
File will be generated if not found.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
serviceDependencies = lib.mkOption {
|
||||||
|
type = with lib.types; listOf str;
|
||||||
|
default = lib.optional config.services.matrix-synapse.enable config.services.matrix-synapse.serviceUnit;
|
||||||
|
defaultText = lib.literalExpression ''
|
||||||
|
lib.optional config.services.matrix-synapse.enable config.services.matrix-synapse.serviceUnit
|
||||||
|
'';
|
||||||
|
description = ''
|
||||||
|
List of Systemd services to require and wait for when starting the application service,
|
||||||
|
such as the Matrix homeserver if it's running on the same host.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
systemd.services.matrix-hookshot = {
|
||||||
|
description = "a bridge between Matrix and multiple project management services";
|
||||||
|
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
wants = [ "network-online.target" ] ++ cfg.serviceDependencies;
|
||||||
|
after = [ "network-online.target" ] ++ cfg.serviceDependencies;
|
||||||
|
|
||||||
|
preStart = ''
|
||||||
|
if [ ! -f '${cfg.settings.passFile}' ]; then
|
||||||
|
mkdir -p $(dirname '${cfg.settings.passFile}')
|
||||||
|
${pkgs.openssl}/bin/openssl genpkey -out '${cfg.settings.passFile}' -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:4096
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "simple";
|
||||||
|
Restart = "always";
|
||||||
|
ExecStart = "${cfg.package}/bin/matrix-hookshot ${configFile} ${cfg.registrationFile}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
meta.maintainers = with lib.maintainers; [ flandweber ];
|
||||||
|
}
|
|
@ -8,7 +8,7 @@ mjolnir:
|
||||||
access_token: ENC[AES256_GCM,data:ERFqZjK7MRD0xWt91FNCIxP1YC6Qj54QgnckHlCTtcQVLWaM1h2h9lHS+K8=,iv:1d7vmFkXAPcsmumzlmOT31amdrKLWtL5sJiS8G9g+LE=,tag:2l0vWzJ6P12ofuBdf5CCWw==,type:str]
|
access_token: ENC[AES256_GCM,data:ERFqZjK7MRD0xWt91FNCIxP1YC6Qj54QgnckHlCTtcQVLWaM1h2h9lHS+K8=,iv:1d7vmFkXAPcsmumzlmOT31amdrKLWtL5sJiS8G9g+LE=,tag:2l0vWzJ6P12ofuBdf5CCWw==,type:str]
|
||||||
registrations:
|
registrations:
|
||||||
mx-puppet-discord: ENC[AES256_GCM,data:FleyXxgOmc05nTP6M2DBJlacufN3p/05eZm4kB8+K4ci0k24o3zli988wlM/kyeZmxu4pgQlJ3lNLte4uip2hBXHWG5t5Ldzmr7bNCUD+r7nM+I1lfNkrDROPZ54bHysmn9O5CHpEa16rSo6RJgncIPqsLJxTwjC7qZlkOpzqvMhkq/MHCVOpvg0M/6AUR+AlSZoggujBMoXLznQNQapN13foEsbuo/QxjszM/ObGmhYMVyaS+TDBXzQLA8Yuj50Q/gZCIINWZ4G2qmgsGxxNR4I+usUQml/jxCtIXS4zn/ettXfL9G4Fdm2F9u1v11DehtTGa5xoxDq94M9rIxOqeJpvgEQEyyKAyFUIrlINfGl7tAj4Zu7+9Z8JTRAnppjM1q8iInwn/Z2L9KgB0YFi/Go1whgXly+TH6hpreo7m5klXV/ff/aV3ghOgFCGA8nBrZFqE8Uw268q9tV1s1dxCb6TbpGf19V5c9MD6BsCIVeoq+j9I/I8iZpzg2Reb4IlHhMDwbwsL2w2ks30wiZ9XO/CFrXDY4uBlI=,iv:3vvkGvldS8Raibg6tzlV8VY1O9NCLxSuNX/lwi1QgiA=,tag:D/noIsE3xlOiYM6Pk+cc8Q==,type:str]
|
mx-puppet-discord: ENC[AES256_GCM,data:FleyXxgOmc05nTP6M2DBJlacufN3p/05eZm4kB8+K4ci0k24o3zli988wlM/kyeZmxu4pgQlJ3lNLte4uip2hBXHWG5t5Ldzmr7bNCUD+r7nM+I1lfNkrDROPZ54bHysmn9O5CHpEa16rSo6RJgncIPqsLJxTwjC7qZlkOpzqvMhkq/MHCVOpvg0M/6AUR+AlSZoggujBMoXLznQNQapN13foEsbuo/QxjszM/ObGmhYMV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6DjLztysC/ibwcn92HI8pHRUc41jLslQLT//dV5QBOyW7F2JyCe/A4J5VEVphn3xLqLC/1xH0pwNaevWxR5hqPzm9XC9zn4UV3OMzVj76xDxywh3QaC3B7ZdHlOoyKNXeL5UDhmDjXbGyrxP1HdOAfITpafS9tbfCYROp31j0Q32PC5fUvEjbVYMq5do17/+MEfVdk4p695N3cqLnyoinh0u7KZZw7Im80mk0+zJrChy6D6dVAEZd/AQFgvcY2q3cbOWA/EuniCZrVFAp9u/mljPdeO3MZiJSc7MyElo2CD0YllZeE+KYoHQrIgWJZ6TiItVk3CyLGsYfqNDcJ+o6iicqAdsCiF9IeXO/BfscN2o5sbcvmAShdxCqCYYVtb3Fp6or7bIUf16fq1jkz4XkGwEj+VT9JTXjRbavx5O74VpnyIuTzI7oXYIU4ZUVI5Fkw==,iv:2ffGONfuT9GUVxEStQoZftYUFQc/HcnSLNpZG1t1oCM=,tag:idETgOr/XgfpueTt3gPLHQ==,type:str]
|
||||||
sops:
|
sops:
|
||||||
kms: []
|
kms: []
|
||||||
gcp_kms: []
|
gcp_kms: []
|
||||||
|
@ -69,8 +69,8 @@ sops:
|
||||||
WEh5NFN6SFF1TlltdWFWTGw4MHRHUkUKrKIvC87xjEmwxPQhH8dN+ZuaJTCgPY28
|
WEh5NFN6SFF1TlltdWFWTGw4MHRHUkUKrKIvC87xjEmwxPQhH8dN+ZuaJTCgPY28
|
||||||
pR62KxmoKFICLTHPpYP3euiAx5M9BWvgvCnA/US/5klpk8MtlreNFA==
|
pR62KxmoKFICLTHPpYP3euiAx5M9BWvgvCnA/US/5klpk8MtlreNFA==
|
||||||
-----END AGE ENCRYPTED FILE-----
|
-----END AGE ENCRYPTED FILE-----
|
||||||
lastmodified: "2024-10-12T21:48:59Z"
|
lastmodified: "2024-10-13T05:04:30Z"
|
||||||
mac: ENC[AES256_GCM,data:fLpGjWpoLwwwofwBzkNakD9JoNjbbGOvTEKrrT1jTWXo26Y01NkuqTEEwbmNkODOjmlyeTovRnY3K0dujtEcKJO8Nlu3uNCiL/ie3KitYTQH1lrsI7IdtXvCRELU5trQCqFmBjYUFhFyldKyKL30QxEuYxxTa+t1eBmtOL4jBTY=,iv:kcAPBuA3R5uF6bTfffMgdnsySKxSmCheQx1tOpRwyf4=,tag:aUGRR5w8Ljcdh458ir99DA==,type:str]
|
mac: ENC[AES256_GCM,data:Qtw6ZPxUIp28fw1xFR72Utt+aZZXcXOOJO9lwCsZEsqMKPCtxwNw2NumB4aEBuv16dL14boy/FRtwq0mu/DyA6zgnOeeEzxlcxtFAkqK2A03ZMGEIGYTdB3sBDb2Rm7gnK7J9ypoxb0EP40x18lErk7Cn54B28DPlCkY/tj4B/0=,iv:MRXfroBOUCeWKknjDTfUNNHH91cCkf3vUFAAP+UIN7Y=,tag:awdtYAtmMP2Y72m8PlmgwA==,type:str]
|
||||||
pgp:
|
pgp:
|
||||||
- created_at: "2024-08-04T00:03:46Z"
|
- created_at: "2024-08-04T00:03:46Z"
|
||||||
enc: |-
|
enc: |-
|
||||||
|
|
Loading…
Reference in New Issue