0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 21:50:33 +03:00

matrix-appservice-irc: 2.0.1 -> 3.0.0 (#339603)

This commit is contained in:
Martin Weinelt 2024-09-05 20:08:28 +02:00 committed by GitHub
commit cd601fe2ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 54 additions and 14 deletions

View file

@ -137,6 +137,37 @@ in {
type = submodule { freeformType = jsonType; }; type = submodule { freeformType = jsonType; };
description = "IRC servers to connect to"; description = "IRC servers to connect to";
}; };
mediaProxy = {
signingKeyPath = lib.mkOption {
type = path;
default = "/var/lib/matrix-appservice-irc/media-signingkey.jwk";
description = ''
Path to the signing key file for authenticated media.
'';
};
ttlSeconds = lib.mkOption {
type = ints.positive;
default = 3600;
description = ''
Lifetime in seconds, that generated URLs stay valid.
'';
};
bindPort = lib.mkOption {
type = port;
default = 11111;
description = ''
Port that the media proxy binds to.
'';
};
publicUrl = lib.mkOption {
type = str;
example = "https://matrix.example.com/media";
description = ''
URL under which the media proxy is publicly acccessible.
'';
};
};
}; };
}; };
}; };
@ -144,6 +175,7 @@ in {
}; };
}; };
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
systemd.services.matrix-appservice-irc = { systemd.services.matrix-appservice-irc = {
description = "Matrix-IRC bridge"; description = "Matrix-IRC bridge";
@ -181,6 +213,9 @@ in {
sed -i "s/^hs_token:.*$/$hs_token/g" ${registrationFile} sed -i "s/^hs_token:.*$/$hs_token/g" ${registrationFile}
sed -i "s/^as_token:.*$/$as_token/g" ${registrationFile} sed -i "s/^as_token:.*$/$as_token/g" ${registrationFile}
fi fi
if ! [ -f "${cfg.settings.ircService.mediaProxy.signingKeyPath}"]; then
${lib.getExe pkgs.nodejs} ${pkg}/lib/generate-signing-key.js > "${cfg.settings.ircService.mediaProxy.signingKeyPath}"
fi
# Allow synapse access to the registration # Allow synapse access to the registration
if ${pkgs.getent}/bin/getent group matrix-synapse > /dev/null; then if ${pkgs.getent}/bin/getent group matrix-synapse > /dev/null; then
chgrp matrix-synapse ${registrationFile} chgrp matrix-synapse ${registrationFile}

View file

@ -571,7 +571,7 @@ in {
mate-wayland = handleTest ./mate-wayland.nix {}; mate-wayland = handleTest ./mate-wayland.nix {};
matter-server = handleTest ./matter-server.nix {}; matter-server = handleTest ./matter-server.nix {};
matomo = handleTest ./matomo.nix {}; matomo = handleTest ./matomo.nix {};
matrix-appservice-irc = handleTest ./matrix/appservice-irc.nix {}; matrix-appservice-irc = runTest ./matrix/appservice-irc.nix;
matrix-conduit = handleTest ./matrix/conduit.nix {}; matrix-conduit = handleTest ./matrix/conduit.nix {};
matrix-synapse = handleTest ./matrix/synapse.nix {}; matrix-synapse = handleTest ./matrix/synapse.nix {};
matrix-synapse-workers = handleTest ./matrix/synapse-workers.nix {}; matrix-synapse-workers = handleTest ./matrix/synapse-workers.nix {};

View file

@ -1,4 +1,4 @@
import ../make-test-python.nix ({ pkgs, ... }: { pkgs, ... }:
let let
homeserverUrl = "http://homeserver:8008"; homeserverUrl = "http://homeserver:8008";
in in
@ -9,7 +9,7 @@ import ../make-test-python.nix ({ pkgs, ... }:
}; };
nodes = { nodes = {
homeserver = { pkgs, ... }: { homeserver = {
# We'll switch to this once the config is copied into place # We'll switch to this once the config is copied into place
specialisation.running.configuration = { specialisation.running.configuration = {
services.matrix-synapse = { services.matrix-synapse = {
@ -46,7 +46,7 @@ import ../make-test-python.nix ({ pkgs, ... }:
}; };
}; };
ircd = { pkgs, ... }: { ircd = {
services.ngircd = { services.ngircd = {
enable = true; enable = true;
config = '' config = ''
@ -75,13 +75,16 @@ import ../make-test-python.nix ({ pkgs, ... }:
homeserver.url = homeserverUrl; homeserver.url = homeserverUrl;
homeserver.domain = "homeserver"; homeserver.domain = "homeserver";
ircService.servers."ircd" = { ircService = {
name = "IRCd"; servers."ircd" = {
port = 6667; name = "IRCd";
dynamicChannels = { port = 6667;
enabled = true; dynamicChannels = {
aliasTemplate = "#irc_$CHANNEL"; enabled = true;
aliasTemplate = "#irc_$CHANNEL";
};
}; };
mediaProxy.publicUrl = "http://localhost:11111/media";
}; };
}; };
}; };
@ -203,6 +206,8 @@ import ../make-test-python.nix ({ pkgs, ... }:
with subtest("start the appservice"): with subtest("start the appservice"):
appservice.wait_for_unit("matrix-appservice-irc.service") appservice.wait_for_unit("matrix-appservice-irc.service")
appservice.wait_for_open_port(8009) appservice.wait_for_open_port(8009)
appservice.wait_for_file("/var/lib/matrix-appservice-irc/media-signingkey.jwk")
appservice.wait_for_open_port(11111)
with subtest("copy the registration file"): with subtest("copy the registration file"):
appservice.copy_from_vm("/var/lib/matrix-appservice-irc/registration.yml") appservice.copy_from_vm("/var/lib/matrix-appservice-irc/registration.yml")
@ -222,4 +227,4 @@ import ../make-test-python.nix ({ pkgs, ... }:
with subtest("ensure messages can be exchanged"): with subtest("ensure messages can be exchanged"):
client.succeed("do_test ${homeserverUrl} >&2") client.succeed("do_test ${homeserverUrl} >&2")
''; '';
}) }

View file

@ -13,19 +13,19 @@
let let
pname = "matrix-appservice-irc"; pname = "matrix-appservice-irc";
version = "2.0.1"; version = "3.0.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "matrix-org"; owner = "matrix-org";
repo = pname; repo = pname;
rev = "refs/tags/${version}"; rev = "refs/tags/${version}";
hash = "sha256-ue3fOkrEBRI/NRE+uKFR+NaqP8QvzVVeX3LUh4aZYJA="; hash = "sha256-ZT8ugev+Tgu47KLuVVo5sFfiGtWLDc6JW5NZvsQ1mA8=";
}; };
yarnOfflineCache = fetchYarnDeps { yarnOfflineCache = fetchYarnDeps {
name = "${pname}-${version}-offline-cache"; name = "${pname}-${version}-offline-cache";
yarnLock = "${src}/yarn.lock"; yarnLock = "${src}/yarn.lock";
hash = "sha256-hapEbdjvvzeZHfrpYRW9W3vXkQVNyGZ0qydO34+mQqQ="; hash = "sha256-13OUcxZOlW1pp4uB1aRmqlzKf6rTgyP/nMnLmksXV3w=";
}; };
in in