about summary refs log tree commit diff
path: root/nixos/modules/services/matrix
Commit message (Collapse)AuthorAge
* Merge pull request #292473 from ↵Maximilian Bosch2024-03-15
|\ | | | | | | | | networkException/fix-synapse-unix-socket-permissions nixos/matrix-synapse: allow synapse to write to directories of unix socket paths
| * nixos/matrix-synapse: allow synapse to write to directories of unix socket pathsnetworkException2024-03-01
| | | | | | | | | | | | | | | | | | this patch takes the path of all unix socket listeners and appends their respective parent directories to the ReadWritePaths allow list for the matrix-synapse systemd service. previously configuring a unix socket in a directory not writable by synapse would fail.
* | nixos/matrix-sliding-sync: create runtime directory in /run/matrix-sliding-syncnetworkException2024-03-08
| | | | | | | | | | | | this patch enables the creation of a runtime directory with the default mode 0755 in /run/matrix-sliding-sync to offer a simple option for SYNCV3_BINDADDR when using unix sockets.
* | nixos/matrix-sliding-sync: document unix socket support in SYNCV3_BINDADDRnetworkException2024-02-29
|/
* nixos/matrix-synapse: fix recursive filtering of null valuesMartin Weinelt2024-02-09
| | | | | Using `filterAttrsRecursive` is not sufficient to account for a nested attribute set with list values, like used for listeners.
* nixos/matrix-synapse: add UNIX domain socket listener supportMartin Weinelt2024-02-09
| | | | | | | | | | | | | | | | | | | | Exposes two options, `path` and `mode`, to configure the location and permissions on the socket file. The `mode` needs to be specified as string in octal and will be converted into a decimal integer, so it correctly passes through the YAML parser and arrives at the `os.chmod` call in the Twisted codebase. What a fun detour. Adds an assertion, that either `path` or `bind_addresses` and `port` are configured on every listener. Migrates the default replication listener of the main instance to a UNIX domain socket, because it is more efficient. Introduces the `enableRegistrationScript` option, to gracefully disable the user registration script, when the client listener listens on a UNIX domain socket, which is something the script does not support.
* nixos/hebbot: initRaito Bezarius2024-01-25
| | | | This is a NixOS module to support TWIM-style Matrix bots.
* nixos: fix a bunch of services missing dep on network-online.targetJade Lovelace2024-01-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was done by generating a truly hilarious configuration: rg 'services\.[^.]+\.enable\t' opts-tags | cut -f1 > allonconfig.nix The following were not tested due to other evaluation errors. They should probably be manually audited. services.amule services.castopod services.ceph services.chatgpt-retrieval-plugin services.clamsmtp services.clight services.dante services.dex services.discourse services.dwm-status services.engelsystem services.foundationdb services.frigate services.frp services.grocy services.guacamole-client services.hedgedoc services.home-assistant services.honk services.imaginary services.jitsi-meet services.kerberos_server services.limesurvey services.mastodon services.mediawiki services.mobilizon services.moodle services.mosquitto services.nextcloud services.nullmailer services.patroni services.pfix-srsd services.pgpkeyserver-lite services.postfixadmin services.roundcube services.schleuder services.self-deploy services.slskd services.spacecookie services.statsd services.step-ca services.sympa services.tsmBackup services.vdirsyncer services.vikunja services.yandex-disk services.zabbixWeb
* nixos/matrix-sliding-sync: rename, init dendritesinanmohd2023-12-30
|
* nixos/matrix-synapse: update broken link to redis related docsNick Cao2023-12-13
|
* nixos/matrix-synapse: replace references to matrix-org/synapse with ↵Nick Cao2023-12-13
| | | | element-hq/synapse
* nixos/maubot: fix eval with default configchayleaf2023-12-08
|
* nixos/matrix-appservice-irc: fix syscall filterBenjamin Saunders2023-12-02
| | | | The pre-start script requires @chown; the service fails without it.
* treewide: replace `mkPackageOptionMD` with `mkPackageOption`h7x42023-11-30
|
* Merge pull request #261702 from h7x4/replace-mkoption-with-mkpackageoptionWeijia Wang2023-11-30
|\ | | | | treewide: use `mkPackageOption`
| * treewide: use `mkPackageOption`h7x42023-11-27
| | | | | | | | | | This commit replaces a lot of usages of `mkOption` with the package type, to be `mkPackageOption`, in order to reduce the amount of code.
* | nixos/maubot: initchayleaf2023-11-28
|/
* nixos/postgresql: drop ensurePermissions, fix ensureUsers for postgresql15Maximilian Bosch2023-11-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes #216989 First of all, a bit of context: in PostgreSQL, newly created users don't have the CREATE privilege on the public schema of a database even with `ALL PRIVILEGES` granted via `ensurePermissions` which is how most of the DB users are currently set up "declaratively"[1]. This means e.g. a freshly deployed Nextcloud service will break early because Nextcloud itself cannot CREATE any tables in the public schema anymore. The other issue here is that `ensurePermissions` is a mere hack. It's effectively a mixture of SQL code (e.g. `DATABASE foo` is relying on how a value is substituted in a query. You'd have to parse a subset of SQL to actually know which object are permissions granted to for a user). After analyzing the existing modules I realized that in every case with a single exception[2] the UNIX system user is equal to the db user is equal to the db name and I don't see a compelling reason why people would change that in 99% of the cases. In fact, some modules would even break if you'd change that because the declarations of the system user & the db user are mixed up[3]. So I decided to go with something new which restricts the ways to use `ensure*` options rather than expanding those[4]. Effectively this means that * The DB user _must_ be equal to the DB name. * Permissions are granted via `ensureDBOwnerhip` for an attribute-set in `ensureUsers`. That way, the user is actually the owner and can perform `CREATE`. * For such a postgres user, a database must be declared in `ensureDatabases`. For anything else, a custom state management should be implemented. This can either be `initialScript`, doing it manual, outside of the module or by implementing proper state management for postgresql[5], but the current state of `ensure*` isn't even declarative, but a convergent tool which is what Nix actually claims to _not_ do. Regarding existing setups: there are effectively two options: * Leave everything as-is (assuming that system user == db user == db name): then the DB user will automatically become the DB owner and everything else stays the same. * Drop the `createDatabase = true;` declarations: nothing will change because a removal of `ensure*` statements is ignored, so it doesn't matter at all whether this option is kept after the first deploy (and later on you'd usually restore from backups anyways). The DB user isn't the owner of the DB then, but for an existing setup this is irrelevant because CREATE on the public schema isn't revoked from existing users (only not granted for new users). [1] not really declarative though because removals of these statements are simply ignored for instance: https://github.com/NixOS/nixpkgs/issues/206467 [2] `services.invidious`: I removed the `ensure*` part temporarily because it IMHO falls into the category "manage the state on your own" (see the commit message). See also https://github.com/NixOS/nixpkgs/pull/265857 [3] e.g. roundcube had `"DATABASE ${cfg.database.username}" = "ALL PRIVILEGES";` [4] As opposed to other changes that are considered a potential fix, but also add more things like collation for DBs or passwords that are _never_ touched again when changing those. [5] As suggested in e.g. https://github.com/NixOS/nixpkgs/issues/206467
* nixos/matrix/*: change dependencies on matrix-synapse.service to serviceUnitSophie Tauchert2023-11-05
|
* nixos/matrix-synapse: add readOnly serviceUnit optionSophie Tauchert2023-11-05
| | | | | This is useful to configure services dependent on matrix-synapse regardless of whether workers are enabled or not.
* nixos/matrix-sliding-sync: add dependency on matrix-synapse if running ↵Sophie Tauchert2023-11-05
| | | | locally and restart
* nixos/matrix-synapse: remove opentracing optionsYureka2023-10-22
|
* nixos: fix bad mkEnableOption descriptionsBjørn Forsman2023-10-20
| | | | | Fix descriptions that don't account for (1) the "Whether to enable" prefix or (2) the automatically added trailing dot.
* Merge pull request #260008 from Ma27/synapse-log-configMaximilian Bosch2023-10-16
|\ | | | | nixos/matrix-synapse: mergeable log configuration
| * nixos/synapse: `mkDefault` each value of the log configMaximilian Bosch2023-10-15
| | | | | | | | | | That way it's not even needed to specify an `mkForce` when changing existing attributes, e.g. root's log level.
| * nixos/matrix-synapse: mergeable log configurationMaximilian Bosch2023-10-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Right now there's no trivial way to override parts of synapse's log config such as the log-level because the only thing that's changeable is the path to the log-file used by synapse and its workers. Now, there's a new option called `services.matrix-synapse.log` which contains the default log config as Nix attribute-set (except `handlers.journal.SYSLOG_IDENTIFIER`). It has default priority, so new things can be added like services.matrix-synapse.log = { my.extra.field = 23; } without discarding the rest. If desired, this can still be done via `lib.mkForce`. If the log configuration for a single worker or synapse, but not all workers should be changed, `services.matrix-synapse.settings.log_config` or `services.matrix-synapse.workers._name_.worker_log_config` can be used.
* | Merge pull request #259980 from Ma27/synapse-db-assertionMaximilian Bosch2023-10-10
|\ \ | | | | | | nixos/matrix-synapse: drop old DB check assertion, actually require DB to be up
| * | nixos/matrix-synapse: drop old DB check assertion, actually require DB to be upMaximilian Bosch2023-10-09
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes #236062 The PR #236062 was submitted because of the following problem: a synapse instance was running in a NixOS container attached to the host network and a postgresql instance on the host as database. In this setup, synapse connected to its DB via 127.0.0.1, but the DB wasn't locally set up and thus not configured in NixOS (i.e. `config.services.postgresql.enable` was `false`). This caused the assertion removed in this patch to fail. Over three years ago this assertion was introduced when this module stopped doing autoconfiguration of postgresql entirely[1] because a breaking change in synapse couldn't be managed via an auto-upgrade on our side. To make sure people don't deploy their DB away by accident, this assertion was introduced. Nowadays this doesn't serve any value anymore because people with existing instances should've upgraded by now (otherwise it's their job to carefully read the release notes when missing upgrades for several years) and people deploying fresh instances are instructed by the docs to also configure postgresql[2]. Instead, it only causes issues in corner cases like #236062, so after some discussion in that PR I think it's time to remove the assertion altogether. Also, there's no `Requires=` for `postgresql.service` in the systemd units which means that it's not strictly guaranteed that the DB is up when synapse starts up. This is fixed now by adding `requires`. To avoid being bitten by above mentioned cases again, this only happens if `config.services.postgresql.enable` is `true`. If somebody uses a non-local postgresql, but has also deployed a local postgresql instance on the synapse server (rather unlikely IMHO), it's their job to opt out of this behavior with `mkForce` (this is precisely one of the use-cases `mkForce` and friends were built for IMHO). [1] https://github.com/NixOS/nixpkgs/pull/80447 [2] https://nixos.org/manual/nixos/stable/#module-services-matrix-synapse
* / nixos/matrix-synapse: add media_store_path to services ReadWritePathsJulian Schacher2023-10-09
|/ | | | | | | Currently, when setting a custom media_store_path, which lies outside of cfg.dataDir, the current ReadWritePaths make it so that Synapse can't access the media_store_path. So add the media_store_path to ReadWritePaths to fix that.
* Merge pull request #246117 from Ralith/fix-synapse-well-known-exampleMaximilian Bosch2023-10-08
|\ | | | | nixos/matrix-synapse: fix duplicate Content-Type header in example
| * nixos/matrix-synapse: fix duplicate Content-Type header in exampleBenjamin Saunders2023-07-29
| | | | | | | | | | | | nginx adds a `content-type: application/octet-stream` header by default, and `add_header` does not supplant it. By setting `default_type` instead we avoid the extraneous header.
* | nixos/matrix-sliding-sync: Fix missing lib.mdDocYaya2023-09-28
| |
* | nixos/matrix-synapse: wait for network-online.targetMartin Weinelt2023-09-22
| | | | | | | | | | | | | | | | | | While network.target only guarantees that network devices have been created the `network-online.target` allows delaying service startup until after a configurable network state has been reached. This should resolve spurious failures, e.g. when synapse tries to load the discovery information for its OIDC provider from a remote host.
* | nixos/matrix-synapse: refactor assertions for missing listener resourcesMaximilian Bosch2023-09-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While reviewing other changes related to synapse I rediscovered the `lib.findFirst (...) (lib.last resources)` hack to find a listener supporting the `client` resource. We decided to keep it that way for now a while ago to avoid scope-creep on the RFC42 refactoring[1]. I wanted to take care of that and forgot about it. Anyways, I'm pretty sure that this is bogus: to register a user, you need the `client` API and not a random listener which happens to be the last one in the list. Also, you need something which serves the `client` API to have the entire synapse<->messenger interaction working (whereas `federation` is for synapse<->synapse). So I decided to error out if no `client` listener is found. A listener serving `client` can be defined in either the main synapse process or one of its workers via `services.matrix-synapse.workers`[2]. However it's generally nicer to use assertions for that because then it's possible to display multiple configuration errors at once and one doesn't have to chase one `throw` after another. I decided to also error out when using the result from `findFirst` though because module assertions aren't thrown necessarily when you evaluate a single config attribute, e.g. `config.environment.systemPackages` which depends on an existing client listener because of `registerNewMatrixUser`[3]. While at it I realized that if `settings.instance_map` is wrongly configured, e.g. by settings.instance_map = mkForce { /* no `main` in here */ } an `attribute ... missing` error will be thrown while evaluating the worker assertion. [1] https://github.com/NixOS/nixpkgs/pull/158605#discussion_r815500487 [2] This also means that `registerNewMatrixUser` will still work if you offload the entire `client` traffic to a worker. [3] And getting a useful error message is way better for debugging in such a case than `value is null while a set was expected`.
* | nixos/synapse: make sure workers require main processSophie Tauchert2023-09-18
| | | | | | | | | | | | This should ensure systemd handles starting all services (main and workers) in a single transaction, thus preserving unit orderings defined through After= even when not restarting the target.
* | nixos/synapse: add documentation for required reverse proxy setupSophie Tauchert2023-09-18
| |
* | nixos/synapse: default tls to off for workers and document worker ↵Sophie Tauchert2023-09-18
| | | | | | | | replication port
* | nixos/synapse: simplify replication listener assertionSophie Tauchert2023-09-18
| |
* | nixos/synapse: move services.matrix-synapse.workers.config to ↵Sophie Tauchert2023-09-18
| | | | | | | | services.matrix-synapse.workers
* | nixos/synapse: automatically configure logging for synapse and workersSophie Tauchert2023-09-18
| |
* | nixos/synapse: remove obsolete log contextSophie Tauchert2023-09-18
| | | | | | | | see https://github.com/matrix-org/synapse/commit/0304ad0c3d79e44e78f9658e71f1e1533e3aa4e2 for when this was removed upstream
* | nixos/synapse: document options betterSophie Tauchert2023-09-18
| | | | | | | | Co-authored-by: Daniel Olsen <daniel.olsen99@gmail.com>
* | nixos/synapse: automatically configure replication listenerSophie Tauchert2023-09-18
| |
* | nixos/synapse: add options to configure workersSophie Tauchert2023-09-18
| |
* | nixos/synapse: add option to configure redis automaticallySophie Tauchert2023-09-18
| |
* | nixos/synapse: update listener settingsSophie Tauchert2023-09-18
| | | | | | | | | | The resource type health is currently missing, but should be available according to https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#listeners
* | nixos/synapse: cleanup, split out listener type and service configSophie Tauchert2023-09-18
| |
* | nixos/matrix-synapse: fix type of `settings.url_preview_url_blacklist`Maximilian Bosch2023-09-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Actually, it's supposed to be `listOf (attrsOf str)` because each list-item can match against multiple properties from `urlsplit`[1]. In fact, `listOf str` breaks URL previews at runtime: Sep 14 15:03:47 soost synapse[1100355]: synapse.http.server: [GET-116] Failed handle request via 'PreviewUrlResource': <XForwardedForRequest at 0x7f691bd5f730 method='GET' uri='/_matrix/media/r0/preview_url?url=<redacted>' clientproto='HTTP/1.1' site='8448'> Traceback (most recent call last): [...] File "/nix/store/xk5yksbw09p6qwk0maq2cb2in3z6f4gn-matrix-synapse-1.91.2/lib/python3.10/site-packages/synapse/media/url_previewer.py", line 398, in _is_url_blocked for attrib, pattern in entry.items(): AttributeError: 'str' object has no attribute 'items' To make sure that people aren't confused when upgrading their configs, I decided to work with `types.coercedTo` to "pretend" accepting the old type signature, but then throwing an error explaining what to do (and rejecting the broken configuration). [1] https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urlsplit
* | Merge pull request #253121 from NickCao/mautrixNick Cao2023-09-04
|\ \ | | | | | | python310Packages.mautrix: 0.20.0 -> 0.20.1
| * | nixos/mautrix-telegram: drop removed --base-config flagNick Cao2023-09-03
| | | | | | | | | | | | See also: https://github.com/mautrix/python/commit/9b67b17ac4927f63cc9a71dc450b9296c849b3ab