about summary refs log tree commit diff
path: root/nixos/modules/services/matrix
AgeCommit message (Collapse)AuthorFilesLines
2024-05-05nixos/mautrix-signal: add moduleNiklas Korz1-0/+249
2024-05-03conduit: Drop piegames from maintainerspiegames1-1/+1
2024-04-27nixos/matrix-appservice-irc: fix chown of registration.yml in pre-scriptPatrick Steinhardt1-1/+2
Before the startup, the matrix-appservice-irc service sets up the registration file such that it can be used by matrix-synapse. Part of that setup requires us to change the group of said file so that the home server can read it. Consequently, we need CAP_CHOWN and require that the @chown system calls are allowed. While we supposedly set up both of these, the setup of system calls is broken as we have both an allow and a deny list of syscalls. But while the allow list contains "@chown", the deny list contains "@privileged" which contains "@chown" itself. So ultimately, we end up denying "@chown". Fix this issue by specifying "@chown" after the deny list.
2024-04-24docs(conduit): update link to config docsnat-4181-1/+1
2024-04-13Merge pull request #302586 from Ma27/synapse-initialscript-docsMaximilian Bosch1-8/+21
nixos/matrix-synapse: don't use `services.postgresql.initialScript` in setup example
2024-04-13nixos: remove all uses of lib.mdDocstuebinm15-199/+199
these changes were generated with nixq 0.0.2, by running nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix two mentions of the mdDoc function remain in nixos/, both of which are inside of comments. Since lib.mdDoc is already defined as just id, this commit is a no-op as far as Nix (and the built manual) is concerned.
2024-04-10nixos/matrix-synapse: don't use `services.postgresql.initialScript` in setup ↵Maximilian Bosch1-8/+21
example Closes #285688 This is misleading because `initialScript` will only be executed at the *very first* run of postgresql. I.e. when deploying synapse to a server with an existing postgresql, this won't work. We don't have a good way of automatically provisioning databases _declaratively_, so for now just explain what needs to be done here and leave it to the user how to include this into their deployment.
2024-04-09nixos: improve many 'enable' descriptionsBjørn Forsman1-1/+1
2024-04-05nixos/mautrix-meta: fix lax enable checkColin1-1/+1
enabledInstances is an attrset: the previous logic would always pass and result in, for example, a `mautrix-meta` and a `mautrix-meta-registration` group being shipped to every nixos machine whether mautrix was enabled or not.
2024-04-04Merge pull request #296718 from Rutherther/mautrix-meta-initKevin Cox1-0/+562
mautrix-meta: init at 0.2.0
2024-04-02mautrix-meta: init serviceRutherther1-0/+562
Acked-by: Rutherther <rutherther@proton.me>
2024-03-28treewide: Fix all Nix ASTs in all markdown filesJanne Heß1-42/+48
This allows for correct highlighting and maybe future automatic formatting. The AST was verified to work with nixfmt only.
2024-03-28treewide: Mark Nix blocks in markdown as NixJanne Heß2-5/+5
This should help us with highlighting and future formatting.
2024-03-15Merge pull request #292473 from ↵Maximilian Bosch1-1/+2
networkException/fix-synapse-unix-socket-permissions nixos/matrix-synapse: allow synapse to write to directories of unix socket paths
2024-03-08nixos/matrix-sliding-sync: create runtime directory in /run/matrix-sliding-syncnetworkException1-0/+1
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.
2024-03-01nixos/matrix-synapse: allow synapse to write to directories of unix socket pathsnetworkException1-1/+2
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.
2024-02-29nixos/matrix-sliding-sync: document unix socket support in SYNCV3_BINDADDRnetworkException1-1/+1
2024-02-09nixos/matrix-synapse: fix recursive filtering of null valuesMartin Weinelt1-1/+9
Using `filterAttrsRecursive` is not sufficient to account for a nested attribute set with list values, like used for listeners.
2024-02-09nixos/matrix-synapse: add UNIX domain socket listener supportMartin Weinelt2-21/+140
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.
2024-01-25nixos/hebbot: initRaito Bezarius1-0/+78
This is a NixOS module to support TWIM-style Matrix bots.
2024-01-19nixos: fix a bunch of services missing dep on network-online.targetJade Lovelace1-0/+2
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
2023-12-30nixos/matrix-sliding-sync: rename, init dendritesinanmohd1-2/+7
2023-12-13nixos/matrix-synapse: update broken link to redis related docsNick Cao1-1/+1
2023-12-13nixos/matrix-synapse: replace references to matrix-org/synapse with ↵Nick Cao2-11/+11
element-hq/synapse
2023-12-08nixos/maubot: fix eval with default configchayleaf1-1/+1
2023-12-02nixos/matrix-appservice-irc: fix syscall filterBenjamin Saunders1-1/+1
The pre-start script requires @chown; the service fails without it.
2023-11-30treewide: replace `mkPackageOptionMD` with `mkPackageOption`h7x42-2/+2
2023-11-30Merge pull request #261702 from h7x4/replace-mkoption-with-mkpackageoptionWeijia Wang2-16/+2
treewide: use `mkPackageOption`
2023-11-28nixos/maubot: initchayleaf2-0/+562
2023-11-27treewide: use `mkPackageOption`h7x42-16/+2
This commit replaces a lot of usages of `mkOption` with the package type, to be `mkPackageOption`, in order to reduce the amount of code.
2023-11-13nixos/postgresql: drop ensurePermissions, fix ensureUsers for postgresql15Maximilian Bosch2-5/+3
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
2023-11-05nixos/matrix/*: change dependencies on matrix-synapse.service to serviceUnitSophie Tauchert6-10/+10
2023-11-05nixos/matrix-synapse: add readOnly serviceUnit optionSophie Tauchert1-0/+13
This is useful to configure services dependent on matrix-synapse regardless of whether workers are enabled or not.
2023-11-05nixos/matrix-sliding-sync: add dependency on matrix-synapse if running ↵Sophie Tauchert1-2/+7
locally and restart
2023-10-22nixos/matrix-synapse: remove opentracing optionsYureka1-2/+0
2023-10-20nixos: fix bad mkEnableOption descriptionsBjørn Forsman1-2/+2
Fix descriptions that don't account for (1) the "Whether to enable" prefix or (2) the automatically added trailing dot.
2023-10-16Merge pull request #260008 from Ma27/synapse-log-configMaximilian Bosch1-22/+60
nixos/matrix-synapse: mergeable log configuration
2023-10-15nixos/synapse: `mkDefault` each value of the log configMaximilian Bosch1-3/+5
That way it's not even needed to specify an `mkForce` when changing existing attributes, e.g. root's log level.
2023-10-10Merge pull request #259980 from Ma27/synapse-db-assertionMaximilian Bosch1-18/+5
nixos/matrix-synapse: drop old DB check assertion, actually require DB to be up
2023-10-09nixos/matrix-synapse: mergeable log configurationMaximilian Bosch1-22/+58
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.
2023-10-09nixos/matrix-synapse: drop old DB check assertion, actually require DB to be upMaximilian Bosch1-18/+5
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
2023-10-09nixos/matrix-synapse: add media_store_path to services ReadWritePathsJulian Schacher1-1/+1
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.
2023-10-08Merge pull request #246117 from Ralith/fix-synapse-well-known-exampleMaximilian Bosch1-1/+1
nixos/matrix-synapse: fix duplicate Content-Type header in example
2023-09-28nixos/matrix-sliding-sync: Fix missing lib.mdDocYaya1-2/+2
2023-09-22nixos/matrix-synapse: wait for network-online.targetMartin Weinelt1-2/+2
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.
2023-09-20nixos/matrix-synapse: refactor assertions for missing listener resourcesMaximilian Bosch1-16/+23
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`.
2023-09-18nixos/synapse: make sure workers require main processSophie Tauchert1-0/+1
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.
2023-09-18nixos/synapse: add documentation for required reverse proxy setupSophie Tauchert1-0/+6
2023-09-18nixos/synapse: default tls to off for workers and document worker ↵Sophie Tauchert1-5/+9
replication port
2023-09-18nixos/synapse: simplify replication listener assertionSophie Tauchert1-2/+2