|
|
|
@ -6,10 +6,10 @@ let |
|
|
|
|
|
|
|
|
|
cfg = config.services.mailman; |
|
|
|
|
|
|
|
|
|
pythonEnv = pkgs.python3.withPackages (ps: |
|
|
|
|
[ps.mailman ps.mailman-web] |
|
|
|
|
++ lib.optional cfg.hyperkitty.enable ps.mailman-hyperkitty |
|
|
|
|
++ cfg.extraPythonPackages); |
|
|
|
|
inherit (pkgs.mailmanPackages.buildEnvs { withHyperkitty = cfg.hyperkitty.enable; }) |
|
|
|
|
mailmanEnv webEnv; |
|
|
|
|
|
|
|
|
|
withPostgresql = config.services.postgresql.enable; |
|
|
|
|
|
|
|
|
|
# This deliberately doesn't use recursiveUpdate so users can |
|
|
|
|
# override the defaults. |
|
|
|
@ -72,6 +72,9 @@ in { |
|
|
|
|
stored in the world-readable Nix store. To continue using |
|
|
|
|
Hyperkitty, you must set services.mailman.hyperkitty.enable = true. |
|
|
|
|
'') |
|
|
|
|
(mkRemovedOptionModule [ "services" "mailman" "package" ] '' |
|
|
|
|
Didn't have an effect for several years. |
|
|
|
|
'') |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
options = { |
|
|
|
@ -84,14 +87,6 @@ in { |
|
|
|
|
description = "Enable Mailman on this host. Requires an active MTA on the host (e.g. Postfix)."; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
package = mkOption { |
|
|
|
|
type = types.package; |
|
|
|
|
default = pkgs.mailman; |
|
|
|
|
defaultText = literalExpression "pkgs.mailman"; |
|
|
|
|
example = literalExpression "pkgs.mailman.override { archivers = []; }"; |
|
|
|
|
description = "Mailman package to use"; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
enablePostfix = mkOption { |
|
|
|
|
type = types.bool; |
|
|
|
|
default = true; |
|
|
|
@ -185,7 +180,7 @@ in { |
|
|
|
|
mailman.layout = "fhs"; |
|
|
|
|
|
|
|
|
|
"paths.fhs" = { |
|
|
|
|
bin_dir = "${pkgs.python3Packages.mailman}/bin"; |
|
|
|
|
bin_dir = "${pkgs.mailmanPackages.mailman}/bin"; |
|
|
|
|
var_dir = "/var/lib/mailman"; |
|
|
|
|
queue_dir = "$var_dir/queue"; |
|
|
|
|
template_dir = "$var_dir/templates"; |
|
|
|
@ -295,9 +290,12 @@ in { |
|
|
|
|
name = "mailman-tools"; |
|
|
|
|
# We don't want to pollute the system PATH with a python |
|
|
|
|
# interpreter etc. so let's pick only the stuff we actually |
|
|
|
|
# want from pythonEnv |
|
|
|
|
# want from {web,mailman}Env |
|
|
|
|
pathsToLink = ["/bin"]; |
|
|
|
|
paths = [pythonEnv]; |
|
|
|
|
paths = [ mailmanEnv webEnv ]; |
|
|
|
|
# Only mailman-related stuff is installed, the rest is removed |
|
|
|
|
# in `postBuild`. |
|
|
|
|
ignoreCollisions = true; |
|
|
|
|
postBuild = '' |
|
|
|
|
find $out/bin/ -mindepth 1 -not -name "mailman*" -delete |
|
|
|
|
''; |
|
|
|
@ -320,12 +318,14 @@ in { |
|
|
|
|
description = "GNU Mailman Master Process"; |
|
|
|
|
before = lib.optional cfg.enablePostfix "postfix.service"; |
|
|
|
|
after = [ "network.target" ] |
|
|
|
|
++ lib.optional cfg.enablePostfix "postfix-setup.service"; |
|
|
|
|
++ lib.optional cfg.enablePostfix "postfix-setup.service" |
|
|
|
|
++ lib.optional withPostgresql "postgresql.service"; |
|
|
|
|
restartTriggers = [ config.environment.etc."mailman.cfg".source ]; |
|
|
|
|
requires = optional withPostgresql "postgresql.service"; |
|
|
|
|
wantedBy = [ "multi-user.target" ]; |
|
|
|
|
serviceConfig = { |
|
|
|
|
ExecStart = "${pythonEnv}/bin/mailman start"; |
|
|
|
|
ExecStop = "${pythonEnv}/bin/mailman stop"; |
|
|
|
|
ExecStart = "${mailmanEnv}/bin/mailman start"; |
|
|
|
|
ExecStop = "${mailmanEnv}/bin/mailman stop"; |
|
|
|
|
User = "mailman"; |
|
|
|
|
Group = "mailman"; |
|
|
|
|
Type = "forking"; |
|
|
|
@ -340,6 +340,8 @@ in { |
|
|
|
|
before = [ "mailman.service" "mailman-web-setup.service" "mailman-uwsgi.service" "hyperkitty.service" ]; |
|
|
|
|
requiredBy = [ "mailman.service" "mailman-web-setup.service" "mailman-uwsgi.service" "hyperkitty.service" ]; |
|
|
|
|
path = with pkgs; [ jq ]; |
|
|
|
|
after = optional withPostgresql "postgresql.service"; |
|
|
|
|
requires = optional withPostgresql "postgresql.service"; |
|
|
|
|
serviceConfig.Type = "oneshot"; |
|
|
|
|
script = '' |
|
|
|
|
mailmanDir=/var/lib/mailman |
|
|
|
@ -381,9 +383,9 @@ in { |
|
|
|
|
restartTriggers = [ config.environment.etc."mailman3/settings.py".source ]; |
|
|
|
|
script = '' |
|
|
|
|
[[ -e "${webSettings.STATIC_ROOT}" ]] && find "${webSettings.STATIC_ROOT}/" -mindepth 1 -delete |
|
|
|
|
${pythonEnv}/bin/mailman-web migrate |
|
|
|
|
${pythonEnv}/bin/mailman-web collectstatic |
|
|
|
|
${pythonEnv}/bin/mailman-web compress |
|
|
|
|
${webEnv}/bin/mailman-web migrate |
|
|
|
|
${webEnv}/bin/mailman-web collectstatic |
|
|
|
|
${webEnv}/bin/mailman-web compress |
|
|
|
|
''; |
|
|
|
|
serviceConfig = { |
|
|
|
|
User = cfg.webUser; |
|
|
|
@ -397,14 +399,16 @@ in { |
|
|
|
|
uwsgiConfig.uwsgi = { |
|
|
|
|
type = "normal"; |
|
|
|
|
plugins = ["python3"]; |
|
|
|
|
home = pythonEnv; |
|
|
|
|
home = webEnv; |
|
|
|
|
module = "mailman_web.wsgi"; |
|
|
|
|
http = "127.0.0.1:18507"; |
|
|
|
|
}; |
|
|
|
|
uwsgiConfigFile = pkgs.writeText "uwsgi-mailman.json" (builtins.toJSON uwsgiConfig); |
|
|
|
|
in { |
|
|
|
|
wantedBy = ["multi-user.target"]; |
|
|
|
|
requires = ["mailman-uwsgi.socket" "mailman-web-setup.service"]; |
|
|
|
|
after = optional withPostgresql "postgresql.service"; |
|
|
|
|
requires = ["mailman-uwsgi.socket" "mailman-web-setup.service"] |
|
|
|
|
++ optional withPostgresql "postgresql.service"; |
|
|
|
|
restartTriggers = [ config.environment.etc."mailman3/settings.py".source ]; |
|
|
|
|
serviceConfig = { |
|
|
|
|
# Since the mailman-web settings.py obstinately creates a logs |
|
|
|
@ -422,7 +426,7 @@ in { |
|
|
|
|
startAt = "daily"; |
|
|
|
|
restartTriggers = [ config.environment.etc."mailman.cfg".source ]; |
|
|
|
|
serviceConfig = { |
|
|
|
|
ExecStart = "${pythonEnv}/bin/mailman digests --send"; |
|
|
|
|
ExecStart = "${mailmanEnv}/bin/mailman digests --send"; |
|
|
|
|
User = "mailman"; |
|
|
|
|
Group = "mailman"; |
|
|
|
|
}; |
|
|
|
@ -434,7 +438,7 @@ in { |
|
|
|
|
restartTriggers = [ config.environment.etc."mailman3/settings.py".source ]; |
|
|
|
|
wantedBy = [ "mailman.service" "multi-user.target" ]; |
|
|
|
|
serviceConfig = { |
|
|
|
|
ExecStart = "${pythonEnv}/bin/mailman-web qcluster"; |
|
|
|
|
ExecStart = "${webEnv}/bin/mailman-web qcluster"; |
|
|
|
|
User = cfg.webUser; |
|
|
|
|
Group = "mailman"; |
|
|
|
|
WorkingDirectory = "/var/lib/mailman-web"; |
|
|
|
@ -453,7 +457,7 @@ in { |
|
|
|
|
inherit startAt; |
|
|
|
|
restartTriggers = [ config.environment.etc."mailman3/settings.py".source ]; |
|
|
|
|
serviceConfig = { |
|
|
|
|
ExecStart = "${pythonEnv}/bin/mailman-web runjobs ${name}"; |
|
|
|
|
ExecStart = "${webEnv}/bin/mailman-web runjobs ${name}"; |
|
|
|
|
User = cfg.webUser; |
|
|
|
|
Group = "mailman"; |
|
|
|
|
WorkingDirectory = "/var/lib/mailman-web"; |
|
|
|
@ -462,7 +466,7 @@ in { |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
meta = { |
|
|
|
|
maintainers = with lib.maintainers; [ lheckemann qyliss ]; |
|
|
|
|
maintainers = with lib.maintainers; [ lheckemann qyliss ma27 ]; |
|
|
|
|
doc = ./mailman.xml; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|