Commit graph

62 commits

Author SHA1 Message Date
Alyssa Ross 7ddca49451 nixos/mailman: set RemainAfterExit for settings
This seems to be required to have the unit re-run if
services.mailman.restApiPassFile gets set.
2023-05-19 12:03:41 +02:00
Alyssa Ross 43465c94d4 nixos/mailman: randomly generate REST API token 2023-05-19 12:03:41 +02:00
pennae 0a6e6cf7e6 nixos/manual: render module chapters with nixos-render-docs
this converts meta.doc into an md pointer, not an xml pointer. since we
no longer need xml for manual chapters we can also remove support for
manual chapters from md-to-db.sh

since pandoc converts smart quotes to docbook quote elements and our
nixos-render-docs does not we lose this distinction in the rendered
output. that's probably not that bad, our stylesheet didn't make use of
this anyway (and pre-23.05 versions of the chapters didn't use quote
elements either).

also updates the nixpkgs manual to clarify that option docs support all
extensions (although it doesn't support headings at all, so heading
anchors don't work by extension).
2023-01-27 20:07:34 +01:00
Maximilian Bosch 05f6dd4dc6
nixos/mailman: fix hyperkitty css/js when virtualRoot is /
The `manage-script-name` / `mount` approach doesn't work if you don't
serve your instance behind e.g. `/lists`.
2023-01-04 11:59:27 +01:00
figsoda 6bb0dbf91f nixos: fix typos 2022-12-17 19:31:14 -05:00
Maximilian Bosch 367897a68b
nixos/mailman: remove trailing slash from /static location
Otherwise HTTP routes such as `/static/django-mailman3/css/main.css`
will cause a 404.
2022-12-03 13:03:26 +01:00
Alyssa Ross 1cdd9a3fe6
nixos/mailman: add serve.virtualRoot option
On spectrum-os.org, mailman-web is run at /lists.  With this change,
it's possible for us to switch from a custom uWSGI configuration to
the one now built in to the Mailman module.
2022-09-07 07:10:27 +00:00
pennae ef176dcf7e nixos/*: automatically convert option descriptions
conversions were done using https://github.com/pennae/nix-doc-munge
using (probably) rev f34e145 running

    nix-doc-munge nixos/**/*.nix
    nix-doc-munge --import nixos/**/*.nix

the tool ensures that only changes that could affect the generated
manual *but don't* are committed, other changes require manual review
and are discarded.
2022-08-31 16:32:53 +02:00
pennae 61e93df189 nixos/*: automatically convert option docs to MD
once again using nix-doc-munge (69d080323a)
2022-08-03 22:46:41 +02:00
pennae 3aebb4a2be nixos/*: normalize link format
make (almost) all links appear on only a single line, with no
unnecessary whitespace, using double quotes for attributes. this lets us
automatically convert them to markdown easily.

the few remaining links are extremely long link in a gnome module, we'll
come back to those at a later date.
2022-08-03 21:57:46 +02:00
pennae 2e751c0772 treewide: automatically md-convert option descriptions
the conversion procedure is simple:

 - find all things that look like options, ie calls to either `mkOption`
   or `lib.mkOption` that take an attrset. remember the attrset as the
   option
 - for all options, find a `description` attribute who's value is not a
   call to `mdDoc` or `lib.mdDoc`
 - textually convert the entire value of the attribute to MD with a few
   simple regexes (the set from mdize-module.sh)
 - if the change produced a change in the manual output, discard
 - if the change kept the manual unchanged, add some text to the
   description to make sure we've actually found an option. if the
   manual changes this time, keep the converted description

this procedure converts 80% of nixos options to markdown. around 2000
options remain to be inspected, but most of those fail the "does not
change the manual output check": currently the MD conversion process
does not faithfully convert docbook tags like <code> and <package>, so
any option using such tags will not be converted at all.
2022-07-30 15:16:34 +02:00
Maximilian Bosch db9937b578
nixos/mailman: don't leak MAILMAN_REST_API_PASS into the store 2022-07-20 22:23:54 +02:00
Maximilian Bosch 6a5b1bc0a3
nixos/mailman: strip trailing \n when reading the secret 2022-07-04 21:15:56 +02:00
Maximilian Bosch dd4b6b81fa
nixos/mailman: implement LDAP support for postorius 2022-07-04 21:15:53 +02:00
Maximilian Bosch aea3ec632d
mailman: split python env for web and mailman 2022-05-20 01:36:48 +02:00
Maximilian Bosch 72a14ea563
mailman: refactor package structure
* Removed unused `.package`-option.
* Added explicit postgresql support.
* Create a new meta-package for mailman to make sure each component has
  the **same** python and packages can be downgraded if needed (e.g.
  psycopg2 or sqlalchemy) without interfering with `pythonPackages` in any way.
* Document why certain python overrides are needed.

Closes #170035
Closes #158424
2022-05-20 01:21:20 +02:00
Linus Heckemann 5e513b4b24
Merge pull request #167324 from alyssais/mailman-postfix
nixos/{postfix,mailman}: fix ordering between services
2022-04-20 16:34:43 +02:00
Alyssa Ross 572131c6a9
nixos/mailman: ensure Postfix is started after Mailman
On first run, Postfix will refuse to start if it's started before
Mailman is up, because it'll try to read the map files generated
Mailman the first time it's started, and they won't exist yet.  To fix
this, make sure Postfix isn't started until after Mailman is up if
they're both activated at the same time.
2022-04-20 13:17:28 +00:00
Linus Heckemann 0acfc5ed6e
Merge pull request #167323 from alyssais/mailman-ext_dir
nixos/mailman: remove obsolete setting
2022-04-12 21:27:27 +02:00
Linus Heckemann 918a149888
Merge pull request #167322 from alyssais/mailman-webHosts
nixos/mailman: improve empty webHosts error
2022-04-09 20:15:33 +02:00
Alyssa Ross fb2fa1b50f
nixos/postfix: pull setup into its own unit
Consider a service that generates postfix lookup tables with
postmap(1), like Mailman.  It needs the Postfix configuration file to
exist, but Postfix qmgr needs all the lookup tables its configured
with to exist before it starts.  So the service that runs postmap
needs to run after the Postfix configuration and directory structure
is generated, but before Postfix itself is started.  To enable this,
we split Postfix into two units: a oneshot unit that sets up the
configuration, and a longrun unit that supervises the Postfix
daemons.  The postmap services can then be inserted in between these
two units.
2022-04-05 10:24:34 +00:00
Alyssa Ross e7c301df52
nixos/mailman: remove obsolete setting
This was dropped in mailman 3.2.0.
2022-04-05 10:22:21 +00:00
Alyssa Ross f4a0bb8334
nixos/mailman: improve empty webHosts error
Now this configuration mistake will generate the assertion message,
instead of "error: list index 0 is out of bounds".
2022-04-05 10:18:57 +00:00
Wei Tang a62c5f3435
nixos/mailman: use separate virtualHosts 2021-10-17 17:15:12 +02:00
Naïm Favier 2ddc335e6f
nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
Michal Sojka 2a4755e1d4 nixos/mailman: Fix mailman-settings.service configuration
Without this change, mailman-settings.service is not guaranteed to
complete before dependent services. This can lead to various errors
like:

    mailman-web-setup.service: Changing to the requested working directory failed: No such file or directory
2021-06-02 08:20:08 +02:00
Alyssa Ross cc10432418
mailman: add myself as a maintainer all around 2021-04-17 01:07:38 +00:00
Milan Pässler 2ed0f723c7 nixos/mailman: add http listener for uwsgi
With the config suggested in the module docs both Mailman core and
Hyperkitty are running, but Mailman core can not connect to Hyperkitty,
since the default hyperkitty.baseUrl is not set up by the module.

This adds a http listener to the uwsgi config and changes the default
hyperkitty.baseUrl to connect to this http listener.
2021-04-16 12:16:12 +02:00
Alyssa Ross 912e11a468 mailman-web: 2019-09-29 -> 2021-04-10
* Make it clearer what code comments apply to
* Fix the state directory (this was changed in the update)
* Add m1cr0man as a maintaner

Co-authored-by: Lucas Savva <lucas@m1cr0man.com>
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2021-04-14 16:23:09 +00:00
Alyssa Ross d0ead9021e
Revert "mailman-web-unstable: 2019-09-29 -> 2021-04-10 (#119135)"
This reverts commit 8dbd553792.

The update has changed where mailman-web looks for its database and
broken the Mailman module in NixOS.
2021-04-14 12:18:44 +00:00
Lucas Savva 8dbd553792
mailman-web-unstable: 2019-09-29 -> 2021-04-10 (#119135)
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2021-04-13 01:31:53 +02:00
Alyssa Ross c7d13b551e
nixos/mailman: remove spurious uwsgi.service dep
b478e0043c removed every other instance of uwsgi.service and
httpd.service from Mailman before and requiredBy lists.  This one
looks like it was just missed, since I can't see a reason to keep it
but remove the others.

Fixes: b478e0043c ("nixos/mailman: refactor")
2021-01-06 10:44:29 +00:00
Linus Heckemann cc786acdce
Merge pull request #105397 from kisik21/mailman-other-mta-support
nixos/mailman: make Postfix support optional (provided you configure the MTA yourself)
2020-12-14 09:46:05 +01:00
Vika ad023b0c88
nixos/mailman: make Postfix support optional (provided you configure the MTA yourself)
Mailman can now work with MTAs other than Postfix. You'll have to configure
it yourself using the options in `services.mailman.settings.mta`.

This addition is reflected in the release notes for 21.03.
2020-12-14 02:41:30 +03:00
Alyssa Ross a2460414cb
nixos/mailman: run non-minutely jobs
Fixes: b478e0043c
 ("nixos/mailman: refactor")
2020-12-11 17:23:50 +00:00
Linus Heckemann d5cc8fb892 nixos/mailman: fix search index location 2020-06-18 17:23:34 +02:00
Linus Heckemann 176bc68a69 mailman: log to journal 2020-06-18 17:23:33 +02:00
Linus Heckemann 3dbbc786f5 nixos/mailman: RFC42-ise 2020-06-18 17:23:33 +02:00
Linus Heckemann 1b8af3e1ae nixos/mailman: fix clearing static files 2020-06-18 17:23:33 +02:00
Linus Heckemann 32c556b039 nixos/mailman: document, add maintainers 2020-06-18 17:23:29 +02:00
Linus Heckemann b478e0043c nixos/mailman: refactor
- Add serve.enable option, which configures uwsgi and nginx to serve
  the mailman-web application;
- Configure services to log to the journal, where possible. Mailman
  Core does not provide any options for this, but will now log to
  /var/log/mailman;
- Use a unified python environment for all components, with an
  extraPackages option to allow use of postgres support and similar;
- Configure mailman's postfix module such that it can generate the
  domain and lmtp maps;
- Fix formatting for option examples;
- Provide a mailman-web user to run the uwsgi service by default
- Refactor Hyperkitty's periodic jobs to reduce repetition in the
  expressions;
- Remove service dependencies not related to functionality included in
  the module, such as httpd -- these should be configured in user config
  when used;
- Move static files root to /var/lib/mailman-web-static by default. This avoids
  permission issues when a static file web server attempts to access
  /var/lib/mailman which is private to mailman. The location can still
  be changed by setting services.mailman.webSettings.STATIC_ROOT;
- Remove the webRoot option, which seems to have been included by
  accident, being an unsuitable directory for serving via HTTP.
- Rename mailman-web.service to mailman-web-setup.service, since it
  doesn't actually serve mailman-web. There is now a
  mailman-uwsgi.service if serve.enable is set to true.
2020-06-18 17:21:41 +02:00
Benjamin Staffin 3a2790c342 services.mailman: RemainAfterExit so settings take effect properly
Prior to this fix, changes to certain settings would not be applied
automatically and users would have to know to manually restart the
affected service.  A prime example of this is
`services.mailman.hyperkitty.baseUrl`, or various things that affect
`mailman3/settings.py`
2020-03-02 02:25:20 +00:00
Alyssa Ross 0167eb303f nixos/mailman: make mailman package configurable
This will allow users to provide other archiver plugins than the
default mailman-hyperkitty.
2020-01-30 23:14:45 +00:00
Alyssa Ross 8f4fd4d9f5 nixos/mailman: restart services when config changed 2020-01-30 23:14:45 +00:00
Alyssa Ross 881dd9963f mailman-web: use upstream, improve NixOS module
Previously, some files were copied into the Nixpkgs tree, which meant
we wouldn't easily be able to update them, and was also just messy.

The reason it was done that way before was so that a few NixOS
options could be substituted in.  Some problems with doing it this way
were that the _package_ changed depending on the values of the
settings, which is pretty strange, and also that it only allowed those
few settings to be set.

In the new model, mailman-web is a usable package without needing to
override, and I've implemented the NixOS options in a much more
flexible way.  NixOS' mailman-web config file first reads the
mailman-web settings to use as defaults, but then it loads another
configuration file generated from the new services.mailman.webSettings
option, so _any_ mailman-web Django setting can be customised by the
user, rather than just the three that were supported before.  I've
kept the old options, but there might not really be any good reason to
keep them.
2020-01-30 23:14:45 +00:00
Alyssa Ross a8538a73a7 mailman: init package for Mailman CLI
We already had python3Packages.mailman, but that's only really usable
as a library.  The only other option was to create a whole Python
environment, which was undesirable to install as a system-wide
package.
2020-01-30 23:14:45 +00:00
Alyssa Ross 8d9636e092 nixos/mailman: don't set Postfix hashes
It's likely that a user might want to set multiple values for
relay_domains, transport_maps, and local_recipient_maps, and the order
is significant.  This means that there's no good way to set these
across multiple NixOS modules, and they should probably all be set
together in the user's Postfix configuration.

So, rather than setting these in the Mailman module, just make the
Mailman module check that the values it needs to occur somewhere, and
advise the user on what to set if not.
2020-01-30 23:14:45 +00:00
Alyssa Ross db0a3712bb nixos/mailman: support running through uwsgi 2020-01-30 23:14:45 +00:00
Alyssa Ross c397d1909f nixos/mailman: don't keep secrets in the Nix store
This replaces all Mailman secrets with ones that are generated the
first time the service is run.  This replaces the hyperkittyApiKey
option, which would lead to a secret in the world-readable store.
Even worse were the secrets hard-coded into mailman-web, which are not
just world-readable, but identical for all users!

services.mailman.hyperkittyApiKey has been removed, and so can no
longer be used to determine whether to enable Hyperkitty.  In its
place, there is a new option, services.mailman.hyperkitty.enable.  For
consistency, services.mailman.hyperkittyBaseUrl has been renamed to
services.mailman.hyperkitty.baseUrl.
2020-01-30 23:14:45 +00:00
Alyssa Ross 112fa077b1 nixos/mailman: siteOwner default -> example
A default of example.com is useful to nobody.  The correct value of
this depends on the system.
2020-01-30 23:14:45 +00:00