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
nixos/mautrix-whatsapp: init module Matrix<->WhatsApp Bridge #59211
Conversation
Thanks for the PR! Some nitpicks regarding |
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.
Thanks a lot for the contribution!
There are two thoughts of mine:
-
Isn't the
registration.yaml
required for the service? I currently generate those locally (that should be documented then) and add it tomautrix-whatsapp
using-r ${./registration.yaml}
. Also,matrix-synapse
seems to require the app-service configuration file. In NixOS it can be added withservices.matrix-synapse.app_service_config_files
. -
In the long-term I'd like to see some kind of
services.matrix-bridges
module where one can configure several bridges for different chat protocols. I guess that right now it should be possible to create some kind of "abstract" module that can be used formautrix-whatsapp
andmautrix-telegram
, but not sure if that's out of scope here.
I start mautrix-telegram service too. I don't know exactly what you want to do ... Something like a json file with a set of configuration for all matrix's bridge ? |
RFC 42 isn't agreed upon yet, but it might some sense, and is surely better extendable than lines of text.
See https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/databases/influxdb.nix#L99 for an example. |
@flokli is it satisfying ? |
I added my module in module-list.nix but it seems there is a problem with this commit |
I guess we can't really cover this in a nixos vm test, as mautrix-webapp might fail on startup if there's no network connection, right? @Ma27, did you give this a test run? |
Not yet. Currently busy with some other stuff, but I'll try to deploy this to my Matrix instance tonight and see what happens :) |
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.
First of all I'd like to note that we when using this module, all secrets will be persisted in the Nix store which means that any user on the target machine can read the secrets. I'm not sure what to do about here, IIRC you have to write everything into the YAML file (#59211 (review)), but I'm not sure.
There may be some workarounds (#59211 (review), https://elvishjerricco.github.io/2018/06/24/secure-declarative-key-management.html), but I haven't tried those out yet. I'm not sure if that's even a blocker, as I'm fairly sure that this is not the only module which handles secrets like this ATM and it's a known problem.
Regarding the module itself: I just deployed a pretty minimalistic config with this module to temporarily replace my current mautrix-whatsapp service with this module. A new HS token is generated, the service successfully starts up and is registered in my homeserver, hence 👍
}; | ||
}; | ||
logging = { | ||
directory = "/var/lib/mautrix-whatsapp/logs"; |
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.
It's a bit neater to make this /var/log/mautrix-whatsapp
instead and then change the unit below.
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.
related tulir/mautrix-appservice-go#8
ExecStart = '' | ||
${pkgs.mautrix-whatsapp}/bin/mautrix-whatsapp -c "${configFile}/config.yaml" | ||
''; | ||
Restart = "on-failure"; |
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.
For the logging to work:
LogsDirectory = "mautrix-whatsapp";
Sorry for this big noise ... will re-open a new one |
Motivation for this change
Add a service to use Matrix<->WhatsApp bridge.
I have some questions that I let here : https://discourse.nixos.org/t/add-path-from-the-nix-store-to-service-configuration-during-build/2629
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)