Skip to content
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: module mautrix-* new service to handle all mautrix services #110404

Closed
wants to merge 2 commits into from

Conversation

eyJhb
Copy link
Member

@eyJhb eyJhb commented Jan 21, 2021

Motivation for this change

This is just a initial work, this is not done I just want to keep this as a placeholder, to be clear that I am working on something! :)

This allows for configs such as:

{ pkgs, config, ... }:

{
  services = {
    mautrix.services = {
      "facebook" = {
        package = pkgs.mautrix-facebook;
        settings = {
          appservice = {
            hostname = "127.0.0.1";
            port = 8493;
          };
          homeserver = {
            address = "http://127.0.0.1:8008";
            domain = "example.com";
          };
        };
      };
    };

    matrix-synapse = {
      enable = true;
      server_name = "example.com";

      app_service_config_files = (pkgs.lib.forEach 
        (builtins.attrNames config.services.mautrix.services)
        (name: config.services.mautrix.registrationDir+"/"+name+".yaml")
      );
    };
  };
}

This service will currently

  • Start the preStartExec script as root
  • Generate registration.yaml (for use with the homeserver)
  • Generate registration.env (to automatically source before running the mautrix instance)
  • Copy over registration.yaml to registrationDir, i.e. /var/lib/mautrix-registration/name.yaml
  • Run the database migration stuff
  • ExecStart will then source registration.env. and then run the appservice.

This module would also remove the previous module for telegram, or rewrite it to use this as the base module for it, as to not duplicate code.

TODO

  • Maybe add mautrix-go support ?
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@eyJhb eyJhb mentioned this pull request Jan 23, 2021
16 tasks
@Pacman99
Copy link
Contributor

I'm working on something similar here: #114419. I'm trying to go further and create something similar but for more than just mautrix.

@eyJhb
Copy link
Member Author

eyJhb commented May 4, 2021

Closing this as #114419 has a better approach

@eyJhb eyJhb closed this May 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants