diff options
author | Parthiv Seetharaman <pachum99@myrdd.info> | 2022-03-13 01:31:05 +0000 |
---|---|---|
committer | Parthiv Seetharaman <pachum99@myrdd.info> | 2022-03-13 01:31:05 +0000 |
commit | bcfc0748e3c4ab71466662c8f217537f7d55ff6e (patch) | |
tree | 88f7bbca39ee6bfbef508cdf677b7ff031ecdcfa /module/as-options.nix | |
parent | cc70149fc40ef67ee8b90a039ba388b3ae82eb82 (diff) | |
parent | 125aeaa50baf9cd0a40ece816760081eb594c51e (diff) |
Merge branch 'allow-more-modules' into 'main'
modules: allow for more modules to be added
See merge request coffeetables/nix-matrix-appservices!5
Diffstat (limited to 'module/as-options.nix')
-rw-r--r-- | module/as-options.nix | 144 |
1 files changed, 0 insertions, 144 deletions
diff --git a/module/as-options.nix b/module/as-options.nix deleted file mode 100644 index 2afbbbf..0000000 --- a/module/as-options.nix +++ /dev/null @@ -1,144 +0,0 @@ -{ systemConfig, lib, pkgs, ... }: -with lib; -types.submodule ({ config, name, ... }: - let - inherit (systemConfig.services.matrix-appservices) - homeserverDomain; - - asFormats = (import ./as-formats.nix) { - inherit name lib pkgs systemConfig; - asConfig = config; - }; - asFormat = asFormats.${config.format}; - settingsFormat = pkgs.formats.json { }; - in - { - options = rec { - - format = mkOption { - type = types.enum (mapAttrsToList (n: _: n) asFormats); - default = "other"; - description = '' - Format of the appservice, used to set option defaults for appservice. - This is usually determined by the library the appservice is based on. - - Below are descriptions for each format - - '' + (concatStringsSep "\n" (mapAttrsToList - (n: v: "${n}: ${v.description}") - asFormats)); - }; - - package = mkOption { - type = types.nullOr types.package; - default = null; - example = "pkgs.mautrix-whatsapp"; - description = '' - The package for the appservice. Used by formats except 'other'. - This is unecessary if startupScript is set. - ''; - }; - - settings = mkOption rec { - type = settingsFormat.type; - apply = recursiveUpdate default; - default = asFormat.settings or { }; - defaultText = "Format will attempt to configure database and allow homeserver users"; - example = literalExpression '' - { - bridge = { - domain = "public-domain.tld"; - homeserverUrl = "http://public-domain.tld:8008"; - }; - } - ''; - description = '' - Appservice configuration as a Nix attribute set. - All environment variables will be substituted. - Including: - - $DIR which refers to the appservice's data directory. - - $AS_TOKEN, $HS_TOKEN which refers to the Appservice and - Homeserver registration tokens. - - Secret tokens, should be specified in serviceConfig.EnvironmentFile - instead of this world-readable attribute set. - - Configuration options should match those described as per your appservice's settings - Check out the confg sample for this. - - ''; - }; - - registrationData = mkOption { - type = settingsFormat.type; - default = asFormat.registrationData or { - namespaces = { - users = [ - { - regex = "@${name}_.*:${homeserverDomain}"; - exclusive = true; - } - { - regex = "@${name}bot:${homeserverDomain}"; - exclusive = true; - } - ]; - }; - }; - defaultText = '' - Reserve usernames under the homeserver that start with - this appservice's name followed by an _ or "bot" - ''; - description = '' - Data to set in the registration file for the appservice. The default - set or the format should usually deal with this. - ''; - }; - - host = mkOption { - type = types.str; - default = "localhost"; - description = '' - The host the appservice will listen on. - Will need to specified in config, but most formats will do it for you using - this option. - ''; - }; - - port = mkOption { - type = types.port; - description = '' - The port the appservice will listen on. - Will need to specified in config, but most formats will do it for you using - this option. - ''; - }; - - startupScript = mkOption { - type = types.str; - default = asFormat.startupScript or ""; - description = '' - Script that starts the appservice. - The settings file will be available as $SETTINGS_FILE - and the registration file as $REGISTRATION_FILE - ''; - }; - - serviceConfig = mkOption rec { - type = types.attrs; - apply = x: default // x; - default = asFormat.serviceConfig or { }; - description = '' - Overrides for settings in the service's serviceConfig - ''; - }; - - serviceDependencies = mkOption { - type = types.listOf types.str; - default = [ ]; - description = '' - Services started before this appservice - ''; - }; - }; - }) |