···6869- The `services.ananicy.extraRules` option now has the type of `listOf attrs` instead of `string`.
70000000071- `etcd` has been updated to 3.5, you will want to read the [3.3 to 3.4](https://etcd.io/docs/v3.5/upgrades/upgrade_3_4/) and [3.4 to 3.5](https://etcd.io/docs/v3.5/upgrades/upgrade_3_5/) upgrade guides
7273- `consul` has been updated to `1.16.0`. See the [release note](https://github.com/hashicorp/consul/releases/tag/v1.16.0) for more details. Once a new Consul version has started and upgraded its data directory, it generally cannot be downgraded to the previous version.
···6869- The `services.ananicy.extraRules` option now has the type of `listOf attrs` instead of `string`.
7071+- The `matrix-synapse` package & module have undergone some significant internal changes, for most setups no intervention is needed, though:
72+ - The option [`services.matrix-synapse.package`](#opt-services.matrix-synapse.package) is now read-only. For modifying the package, use an overlay which modifies `matrix-synapse-unwrapped` instead. More on that below.
73+ - The `enableSystemd` & `enableRedis` arguments have been removed and `matrix-synapse` has been renamed to `matrix-synapse-unwrapped`. Also, several optional dependencies (such as `psycopg2` or `authlib`) have been removed.
74+ - These optional dependencies are automatically added via a wrapper (`pkgs.matrix-synapse.override { extras = ["redis"]; }` for `hiredis` & `txredisapi` for instance) if the relevant config section is declared in `services.matrix-synapse.settings`. For instance, if `services.matrix-synapse.settings.redis.enabled` is set to `true`, `"redis"` will be automatically added to the `extras` list of `pkgs.matrix-synapse`.
75+ - A list of all extras (and the extras enabled by default) can be found at the [option's reference for `services.matrix-synapse.extras`](#opt-services.matrix-synapse.extras).
76+ - In some cases (e.g. for running synapse workers) it was necessary to re-use the `PYTHONPATH` of `matrix-synapse.service`'s environment to have all plugins available. This isn't necessary anymore, instead `config.services.matrix-synapse.package` can be used as it points to the wrapper with properly configured `extras` and also all plugins defined via [`services.matrix-synapse.plugins`](#opt-services.matrix-synapse.plugins) available. This is also the reason for why the option is read-only now, it's supposed to be set by the module only.
77+78- `etcd` has been updated to 3.5, you will want to read the [3.3 to 3.4](https://etcd.io/docs/v3.5/upgrades/upgrade_3_4/) and [3.4 to 3.5](https://etcd.io/docs/v3.5/upgrades/upgrade_3_5/) upgrade guides
7980- `consul` has been updated to `1.16.0`. See the [release note](https://github.com/hashicorp/consul/releases/tag/v1.16.0) for more details. Once a new Consul version has started and upgraded its data directory, it generally cannot be downgraded to the previous version.
+75-12
nixos/modules/services/matrix/synapse.nix
···9 # remove null values from the final configuration
10 finalSettings = lib.filterAttrsRecursive (_: v: v != null) cfg.settings;
11 configFile = format.generate "homeserver.yaml" finalSettings;
12- logConfigFile = format.generate "log_config.yaml" cfg.logConfig;
13-14- pluginsEnv = cfg.package.python.buildEnv.override {
15- extraLibs = cfg.plugins;
16- };
1718 usePostgresql = cfg.settings.database.name == "psycopg2";
19 hasLocalPostgresDB = let args = cfg.settings.database.args; in
···50 "${bindAddress}"
51 }:${builtins.toString listener.port}/"
52 '';
0000000000000000000000053in {
5455 imports = [
···151152 package = mkOption {
153 type = types.package;
154- default = pkgs.matrix-synapse;
155- defaultText = literalExpression "pkgs.matrix-synapse";
00000000000000000000000000000000000156 description = lib.mdDoc ''
157- Overridable attribute of the matrix synapse server package to use.
00000000158 '';
159 };
160···193 default = {};
194 description = mdDoc ''
195 The primary synapse configuration. See the
196- [sample configuration](https://github.com/matrix-org/synapse/blob/v${cfg.package.version}/docs/sample_config.yaml)
197 for possible values.
198199 Secrets should be passed in by using the `extraConfigFiles` option.
···706 ];
707708 services.matrix-synapse.configFile = configFile;
0000709710 users.users.matrix-synapse = {
711 group = "matrix-synapse";
···729 --keys-directory ${cfg.dataDir} \
730 --generate-keys
731 '';
732- environment = {
733- PYTHONPATH = makeSearchPathOutput "lib" cfg.package.python.sitePackages [ pluginsEnv ];
734- } // optionalAttrs (cfg.withJemalloc) {
735 LD_PRELOAD = "${pkgs.jemalloc}/lib/libjemalloc.so";
736 };
737 serviceConfig = {
···9 # remove null values from the final configuration
10 finalSettings = lib.filterAttrsRecursive (_: v: v != null) cfg.settings;
11 configFile = format.generate "homeserver.yaml" finalSettings;
000001213 usePostgresql = cfg.settings.database.name == "psycopg2";
14 hasLocalPostgresDB = let args = cfg.settings.database.args; in
···45 "${bindAddress}"
46 }:${builtins.toString listener.port}/"
47 '';
48+49+ defaultExtras = [
50+ "systemd"
51+ "postgres"
52+ "url-preview"
53+ "user-search"
54+ ];
55+56+ wantedExtras = cfg.extras
57+ ++ lib.optional (cfg.settings ? oidc_providers) "oidc"
58+ ++ lib.optional (cfg.settings ? jwt_config) "jwt"
59+ ++ lib.optional (cfg.settings ? saml2_config) "saml2"
60+ ++ lib.optional (cfg.settings ? opentracing) "opentracing"
61+ ++ lib.optional (cfg.settings ? redis) "redis"
62+ ++ lib.optional (cfg.settings ? sentry) "sentry"
63+ ++ lib.optional (cfg.settings ? user_directory) "user-search"
64+ ++ lib.optional (cfg.settings.url_preview_enabled) "url-preview"
65+ ++ lib.optional (cfg.settings.database.name == "psycopg2") "postgres";
66+67+ wrapped = pkgs.matrix-synapse.override {
68+ extras = wantedExtras;
69+ inherit (cfg) plugins;
70+ };
71in {
7273 imports = [
···169170 package = mkOption {
171 type = types.package;
172+ readOnly = true;
173+ description = lib.mdDoc ''
174+ Reference to the `matrix-synapse` wrapper with all extras
175+ (e.g. for `oidc` or `saml2`) added to the `PYTHONPATH` of all executables.
176+177+ This option is useful to reference the "final" `matrix-synapse` package that's
178+ actually used by `matrix-synapse.service`. For instance, when using
179+ workers, it's possible to run
180+ `''${config.services.matrix-synapse.package}/bin/synapse_worker` and
181+ no additional PYTHONPATH needs to be specified for extras or plugins configured
182+ via `services.matrix-synapse`.
183+184+ However, this means that this option is supposed to be only declared
185+ by the `services.matrix-synapse` module itself and is thus read-only.
186+ In order to modify `matrix-synapse` itself, use an overlay to override
187+ `pkgs.matrix-synapse-unwrapped`.
188+ '';
189+ };
190+191+ extras = mkOption {
192+ type = types.listOf (types.enum (lib.attrNames pkgs.matrix-synapse-unwrapped.optional-dependencies));
193+ default = defaultExtras;
194+ example = literalExpression ''
195+ [
196+ "cache-memory" # Provide statistics about caching memory consumption
197+ "jwt" # JSON Web Token authentication
198+ "opentracing" # End-to-end tracing support using Jaeger
199+ "oidc" # OpenID Connect authentication
200+ "postgres" # PostgreSQL database backend
201+ "redis" # Redis support for the replication stream between worker processes
202+ "saml2" # SAML2 authentication
203+ "sentry" # Error tracking and performance metrics
204+ "systemd" # Provide the JournalHandler used in the default log_config
205+ "url-preview" # Support for oEmbed URL previews
206+ "user-search" # Support internationalized domain names in user-search
207+ ]
208+ '';
209 description = lib.mdDoc ''
210+ Explicitly install extras provided by matrix-synapse. Most
211+ will require some additional configuration.
212+213+ Extras will automatically be enabled, when the relevant
214+ configuration sections are present.
215+216+ Please note that this option is additive: i.e. when adding a new item
217+ to this list, the defaults are still kept. To override the defaults as well,
218+ use `lib.mkForce`.
219 '';
220 };
221···254 default = {};
255 description = mdDoc ''
256 The primary synapse configuration. See the
257+ [sample configuration](https://github.com/matrix-org/synapse/blob/v${pkgs.matrix-synapse-unwrapped.version}/docs/sample_config.yaml)
258 for possible values.
259260 Secrets should be passed in by using the `extraConfigFiles` option.
···767 ];
768769 services.matrix-synapse.configFile = configFile;
770+ services.matrix-synapse.package = wrapped;
771+772+ # default them, so they are additive
773+ services.matrix-synapse.extras = defaultExtras;
774775 users.users.matrix-synapse = {
776 group = "matrix-synapse";
···794 --keys-directory ${cfg.dataDir} \
795 --generate-keys
796 '';
797+ environment = optionalAttrs (cfg.withJemalloc) {
00798 LD_PRELOAD = "${pkgs.jemalloc}/lib/libjemalloc.so";
799 };
800 serviceConfig = {