From 125aeaa50baf9cd0a40ece816760081eb594c51e Mon Sep 17 00:00:00 2001 From: Parthiv Seetharaman Date: Sat, 12 Mar 2022 13:25:47 -0800 Subject: modules: allow for more modules to be added --- module/as-formats.nix | 160 -------------------------------------------------- 1 file changed, 160 deletions(-) delete mode 100644 module/as-formats.nix (limited to 'module/as-formats.nix') diff --git a/module/as-formats.nix b/module/as-formats.nix deleted file mode 100644 index fa7a4cf..0000000 --- a/module/as-formats.nix +++ /dev/null @@ -1,160 +0,0 @@ -{ name, systemConfig, asConfig, lib, pkgs, ... }: - -with lib; -let - inherit (systemConfig.services.matrix-appservices) - homeserverURL - homeserverDomain; - package = asConfig.package; - pname = getName package; - command = "${package}/bin/${pname}"; - - mautrix = { - startupScript = '' - ${command} --config=$SETTINGS_FILE \ - --registration=$REGISTRATION_FILE - ''; - - settings = { - homeserver = { - address = homeserverURL; - domain = homeserverDomain; - }; - - appservice = with asConfig; { - address = "http://${host}:${toString port}"; - - hostname = host; - inherit port; - - state_store_path = "$DIR/mx-state.json"; - # mautrix stores the registration tokens in the config file - as_token = "$AS_TOKEN"; - hs_token = "$HS_TOKEN"; - }; - - bridge = { - username_template = "${name}_{userid}"; - permissions = { - ${homeserverDomain} = "user"; - }; - }; - }; - }; - -in -{ - other = { - description = '' - No defaults will be set. - ''; - }; - - matrix-appservice = { - startupScript = '' - ${command} \ - --config=$SETTINGS_FILE \ - --port=$(echo ${asConfig.listenAddress} | sed 's/.*://') \ - --file=$REGISTRATION_FILE - ''; - - description = '' - For bridges based on the matrix-appservice-bridge library. The settings for these - bridges are NOT configured automatically, because of the various differences - between them. - ''; - }; - - mx-puppet = { - startupScript = '' - ${command} \ - --config=$SETTINGS_FILE \ - --registration-file=$REGISTRATION_FILE - ''; - - registrationData = - let - # mx-puppet virtual users are always created based on the package name - botName = removePrefix "mx-puppet-" pname; - in - { - id = "${botName}-puppet"; - sender_localpart = "_${botName}puppet_bot"; - protocols = [ ]; - namespaces = { - rooms = [ ]; - users = [ - { - regex = "@_${botName}puppet_.*:${homeserverDomain}"; - exclusive = true; - } - ]; - aliases = [ - { - regex = "#_${botName}puppet_.*:${homeserverDomain}"; - exclusive = true; - } - ]; - }; - }; - - settings = { - bridge = { - inherit (asConfig) port; - bindAddress = asConfig.host; - domain = homeserverDomain; - homeserverUrl = homeserverURL; - }; - database.filename = "$DIR/database.db"; - provisioning.whitelist = [ "@.*:${homeserverDomain}" ]; - relay.whitelist = [ "@.*:${homeserverDomain}" ]; - selfService.whitelist = [ "@.*:${homeserverDomain}" ]; - logging = { - lineDateFormat = ""; - files = [ ]; - }; - }; - - serviceConfig.WorkingDirectory = - "${package}/lib/node_modules/${pname}"; - - description = '' - For bridges based on the mx-puppet-bridge library. The settings will be - configured to use a sqlite database. Make sure to override database.filename, - if you plan to use another database. - ''; - - }; - - mautrix-go = { - inherit (mautrix) startupScript; - - settings = recursiveUpdate mautrix.settings { - bridge.username_template = "${name}_{{.}}"; - appservice.database = { - type = "sqlite3"; - uri = "$DIR/database.db"; - }; - }; - - description = '' - The settings are configured to use a sqlite database. The startupScript will - create a new config file on every run to set the tokens, because mautrix - requires them to be in the config file. - ''; - }; - - mautrix-python = { - settings = recursiveUpdate mautrix.settings { - appservice.database = "sqlite:///$DIR/database.db"; - }; - - startupScript = optionalString (package ? alembic) - "${package.alembic}/bin/alembic -x config=$SETTINGS_FILE upgrade head\n" - + mautrix.startupScript; - description = '' - Same properties as mautrix-go. This will also upgrade the database on every run - ''; - }; - -} -- cgit v1.2.3