-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] matrix-appservice-irc: init at 0.12.0 #62864
Conversation
CC: @Ma27 you might be interested by this PR as well ;) |
e2b29cd
to
87b9536
Compare
Awesome! I'll probably have sufficient time this weekend to actually try this out 👍 Regarding the implementation: I wonder if we want to generalize the code here as well. We currently have with this one at least four pending PRs for Matrix Bridges and all of them work pretty similar: #60151, #59211 and #62744. But this is probably out of scope and should be done in a different PR as soon as some of those are merged. On a side note: In case you want to package the Slack integration for Matrix as well, you might want to have a look at the following stuff I've started a while ago:
|
@Ma27 wrote:
I don't think that we would gain much from factorising those modules. That said, I think that we should find a way to decouple those application services from the Matrix homeserver implementation, as new official and third party homeservers may arrive sooner or later (Dendrite, Ruma, Construct to name a few).
The Slack appservice seemed completely broken last time I've tried. |
I'm not sure either... I like the approach of the prometheus exporters module which did a pretty great job at generalising the integration of prometheus exporters without loosing the needed flexibility. But as I said, this is out of scope here, I was interested in your opinion, but I'll wait with this until we have some more modules for new bridges ready :)
Haven't looked at those yet, so I'm afraid I can't say too much about this. I guess that such a registry could contain an attribute set per HS with bridges to use and each bridge module defines which HS to use by an option, right?
Unfortunately I had a pretty similar impression. But no hurries here, I mainly wanted to ensure that we don't do the same work simultaneously. I don't expect you to package the slack integration, especially if it's not relevant for you anymore. |
@Ma27 wrote:
Now that you mention it, this approach seems nice indeed 👍
I'm not sure whether it's possible to set an attribute on a dynamic reference (passed as an option).
I'll let you take care of the Slack bridge :) |
@pacien before I start the testing - can you please move the package into its own directory as done for the discord bridge? It's IMHO better to move such big packages into their own directory as they tend to make the maintenance of such a big package set even harder and it's easier for me to cherry-pick this onto my nixpkgs tracking branch I use to deploy my stuff :) |
87b9536
to
963b9eb
Compare
@Ma27, it's done. |
963b9eb
to
328499d
Compare
@Ma27 wrote:
Even though I agree that it's simpler to isolate and cherry-pick, I remember having been told to do the exact opposite for another PR: #58096 (comment) |
I see 👍 Unfortunately I lack time to spend much time hacking on my infra, I'll probably be able to go back to this at one of the next weekends. Unless somebody is faster than me and merges this, you'll probably need some more patience 😅 |
Here's a configuration snippet that might be useful for reviewers: let
ircSnapshot = builtins.fetchTarball {
url = https://github.com/pacien/nixpkgs/archive/6e74d80d800d72cc0b90b4a42e96f67a44626003.tar.gz;
};
ircPkgs = import ircSnapshot { };
in {
imports = [
"${ircSnapshot}/nixos/modules/services/misc/matrix-appservice-irc.nix"
];
nixpkgs.config.packageOverrides = super: {
inherit (ircPkgs) matrix-appservice-irc;
};
services.matrix-synapse = {
enable = true;
app_service_config_files = [
# generate and add appservice registration file
];
# ...
};
services.matrix-appservice-irc = rec {
enable = true;
registrationFile = /etc/matrix-appservice-irc/registration.yaml;
settings = {
ident.enabled = false;
homeserver = {
url = "http://localhost:8008";
domain = "domain.tld";
media_url = "https://public.endpoint.domain.tld";
};
ircService.servers = {
"irc.freenode.net" = {
name = "Freenode";
port = 6697;
ssl = true;
sslselfsign = false;
sendConnectionMessages = true;
botConfig.enabled = false;
privateMessages = {
enabled = true;
federate = false;
};
dynamicChannels = {
enabled = true;
createAlias = true;
published = false;
joinRule = "invite";
federate = false;
aliasTemplate = "#_freenode_$CHANNEL";
};
membershipLists = {
enabled = true;
global = {
ircToMatrix = { initial = true; incremental = true; };
matrixToIrc = { initial = true; incremental = true; };
};
};
matrixClients = {
userTemplate = "@_freenode_$NICK";
displayName = "$NICK";
};
ircClients = {
nickTemplate = "$DISPLAY";
allowNickChanges = true;
maxClients = 30;
idleTimeout = 172800;
lineLimit = 10;
userModes = "iR";
};
};
};
};
};
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just deployed this onto a Matrix HS (0.99.5 in that case) and it appears to work with freenode as IRC network 👍
328499d
to
b59c928
Compare
b59c928
to
0c21fb0
Compare
0c21fb0
to
d1fa71c
Compare
I wrote my own module just a couple of days ago, but this one looks promising as well. Some things I found useful was giving Autogenerating the registration (L68) and giving it to the matrix group if it exists (L73) is probably a matter of taste. |
d1fa71c
to
6e74d80
Compare
The service is now given that capability if the ident server is enabled on a port that requires it.
It's already done :)
IMO this allows for greater discoverability, hinting the user when looking at the documentation.
This is tricky when the appservice isn't running on the same machine as the homeserver as the token would be overwritten every time anything in the configuration has changed. I'd leave the user manually manage that registration file instead as some explicit intervention would be required anyway.
I've added those options. |
matrix-appservice-irc switched to Typescript since 0.14.0, requiring re-packaging it. Sadly, I don't have enough time to do this myself, so I'll close this pull request. Anyone interested in handling this may feel free to re-use the proposed package and module and submit a new pull request. |
We've been running 0.14.0+ for a while now. The only change I made is that we also bundle dev dependencies, as discussed in this node2nix issue. |
@ajs124, could you open a PR? If nothing else it'd be handy for other people to cherry-pick for their own purposes. |
@Ralith I would have, but turns out our module is way different from what's in here, for some reason (I could have sworn we took this, at some point in the past… was this completely rewritten?). Also, the package we have is literally exactly what's in here, except the generate.sh says nodejs_12 instead of 10. |
Well I haven't taken the module from here, but I rather wrote my own without checking here first. This is why the module is almost entirely different, but it does work. |
It sounds like there's a few versions of the IRC app service. Can someone raise a PR so we can get it into nixpkgs? |
Well I packaged it yet again. @dasJ I have included the module from the gist you posted. |
Motivation for this change
This PR introduces a package and a module for matrix-appservice-irc.
Configuration files are generated from attribute sets (cf NixOS/rfcs#42).
Blockers
Removal of app service registration (to protect the AS' token)mkOverride
values (nixos/mautrix-telegram: add module #63589 (comment))Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)