mailman3: remove defunct submodule

This commit is contained in:
Kevin Baensch 2024-12-21 23:27:08 +01:00
parent 42ef7fa0a5
commit e8370f2322
Signed by: derped
GPG key ID: C0F1D326C7626543
10 changed files with 0 additions and 707 deletions

View file

@ -1,74 +0,0 @@
{
stdenv,
buildPythonPackage,
fetchgit,
aiosmtpd,
alembic,
atpublic,
click,
dnspython,
falcon,
flufl_bounce,
flufl_i18n,
flufl_lock,
importlib-resources,
lazr_config,
passlib,
requests,
sqlalchemy,
zope_component,
zope_configuration,
zope_event,
zope_interface,
# optional database dependencies
pymysql,
psycopg2,
}:
buildPythonPackage rec {
name = "mailman3_core-${version}";
version = "3.2.2";
src = fetchgit {
url = "https://gitlab.com/mailman/mailman.git";
rev = version;
sha256 = "0p1z2i2x6f0g05lx5mymiiw2ij1bsycvbxwabb52nisdddcfhhzp";
};
propagatedBuildInputs = [
aiosmtpd
alembic
atpublic
click
dnspython
falcon
flufl_bounce
flufl_i18n
flufl_lock
importlib-resources
lazr_config
passlib
requests
sqlalchemy
zope_component
zope_configuration
zope_event
zope_interface
pymysql
psycopg2
];
doCheck = false;
# mailman imports master and runner
# -> only wrap $out/bin/mailman
dontWrapPythonPrograms = true;
postFixup = ''
wrapProgram $out/bin/mailman --prefix PYTHONPATH : "$PYTHONPATH"
'';
meta = with stdenv.lib; {
description = "GNU Mailman, a mailing list management system";
license = licenses.gpl3;
maintainers = with maintainers; [ ];
homepage = "http://list.org/";
};
}

View file

@ -1,18 +0,0 @@
{
stdenv,
lib,
fetchPypi,
buildPythonPackage,
atpublic,
}:
buildPythonPackage rec {
pname = "aiosmtpd";
version = "1.2";
src = fetchPypi {
inherit pname version;
sha256 = "1xdfk741pjmz1cm8dsi4n5vq4517i175rm94696m3f7kcgk7xsmp";
};
doCheck = false;
propagatedBuildInputs = [ atpublic ];
}

View file

@ -1,17 +0,0 @@
{
stdenv,
lib,
fetchPypi,
buildPythonPackage,
}:
buildPythonPackage rec {
pname = "atpublic";
version = "1.0";
src = fetchPypi {
inherit pname version;
sha256 = "0i3sbxkdlbb4560rrlmwwd5y4ps7k73lp4d8wnmd7ag9k426gjkx";
};
doCheck = false;
# propagatedBuildInputs = [];
}

View file

@ -1,25 +0,0 @@
{
stdenv,
lib,
fetchPypi,
buildPythonPackage,
atpublic,
zope_interface,
}:
buildPythonPackage rec {
name = "${pname}-${version}";
pname = "flufl.bounce";
version = "3.0";
src = fetchPypi {
inherit pname version;
sha256 = "0k5kjqa3x6gvwwxyzb2vwi1g1i6asm1zw5fivylxz3d583y4kid2";
};
propagatedBuildInputs = [
atpublic
zope_interface
];
doCheck = false;
}

View file

@ -1,21 +0,0 @@
{
stdenv,
lib,
fetchPypi,
buildPythonPackage,
atpublic,
}:
buildPythonPackage rec {
name = "${pname}-${version}";
pname = "flufl.i18n";
version = "2.0.2";
src = fetchPypi {
inherit pname version;
sha256 = "1csgds59nx0ann9v2alqr69lakp1cnc1ikmbgn96l6n23js7c2ah";
};
propagatedBuildInputs = [ atpublic ];
doCheck = false;
}

View file

@ -1,21 +0,0 @@
{
stdenv,
lib,
fetchPypi,
buildPythonPackage,
atpublic,
}:
buildPythonPackage rec {
name = "${pname}-${version}";
pname = "flufl.lock";
version = "3.2";
src = fetchPypi {
inherit pname version;
sha256 = "0nzzd6l30ff6cwsrlrb94xzfja4wkyrqv3ydc6cz0hdbr766mmm8";
};
propagatedBuildInputs = [ atpublic ];
doCheck = false;
}

View file

@ -1,21 +0,0 @@
{
stdenv,
lib,
fetchPypi,
buildPythonPackage,
lazr_delegates,
}:
buildPythonPackage rec {
name = "${pname}-${version}";
pname = "lazr.config";
version = "2.2.1";
src = fetchPypi {
inherit pname version;
sha256 = "1s7pyvlq06qjrkaw9r6nc290lb095n25ybzgavvy51ygpxkgqxwn";
};
propagatedBuildInputs = [ lazr_delegates ];
doCheck = false;
}

View file

@ -1,25 +0,0 @@
{
stdenv,
lib,
fetchPypi,
buildPythonPackage,
nose,
zope_interface,
}:
buildPythonPackage rec {
name = "${pname}-${version}";
pname = "lazr.delegates";
version = "2.0.4";
src = fetchPypi {
inherit pname version;
sha256 = "1rdnl85j9ayp8n85l0ciip621j9dcziz5qnmv2m7krgwgcn31vfx";
};
propagatedBuildInputs = [
nose
zope_interface
];
doCheck = false;
}

View file

@ -1,444 +0,0 @@
{
pkgs,
lib,
config,
...
}:
with lib;
let
mailman3 = import ./release.nix { };
cfg = config.services.mailman3;
usePostgresql = cfg.database.type == "postgresql";
useSqlite = cfg.database.type == "sqlite3";
useMysql = cfg.database.type == "mysql";
usePostfix = cfg.mta.type == "postfix";
configFile_postfix = pkgs.writeText "postfix.cfg" ''
[postfix]
transport_file_type: hash
postmap_command: ${pkgs.postfix}/bin/postmap
'';
configFile = pkgs.writeText "mailman.cfg" ''
# This File was automatically generated by the mailman3 nixos submodule.
# Do not manually edit this file.
[mailman]
site_owner: ${cfg.site_owner}
layout: custom
[paths.custom]
archive_dir: ${cfg.paths.archive_dir}
bin_dir: ${cfg.paths.bin_dir}
cache_dir: ${cfg.paths.cache_dir}
data_dir: ${cfg.paths.data_dir}
etc_dir: ${cfg.paths.etc_dir}
lock_dir: ${cfg.paths.lock_dir}
log_dir: ${cfg.paths.log_dir}
messages_dir: ${cfg.paths.messages_dir}
template_dir: ${cfg.paths.template_dir}
var_dir: ${cfg.paths.var_dir}
lock_file: ${cfg.paths.lock_file}
pid_file: ${cfg.paths.pid_file}
# The Database Documentation can be found here:
# https://mailman.readthedocs.io/en/latest/src/mailman/docs/database.html
# https://docs.sqlalchemy.org/en/latest/core/engines.html#database-urls
[database]
${optionalString useSqlite ''
[database]
url: sqlite:///${cfg.database.socket}
''}
${optionalString usePostgresql ''
class: mailman.database.postgresql.PostgreSQLDatabase
url: postgres://${cfg.database.user}:#dbpass#@${database.host}:${toString cfg.database.port}/${cfg.database.name}
''}
${optionalString useMysql ''
class: mailman.database.mysql.MySQLDatabase
url: mysql+pymysql://${cfg.database.user}:#dbpass#@${cfg.database.host}:${toString cfg.database.port}/${cfg.database.name}?charset=utf8&use_unicode=1
''}
[mta]
incoming: ${cfg.mta.incoming}
outgoing: ${cfg.mta.outgoing}
lmtp_host: ${cfg.mta.lmtp_host}
lmtp_port: ${toString cfg.mta.lmtp_port}
smtp_host: ${cfg.mta.smtp_host}
smtp_port: ${toString cfg.mta.smtp_port}
smtp_user: ${cfg.mta.smtp_user}
smtp_pass: #smtppass#
# One of smtp/smtps/starttls, specifies the protocol Mailman will use when
# connecting. Typically will correspond to smtp_port: 25 -> smtp, 465 -> smtps,
# 587 -> starttls.
smtp_secure_mode: smtp
configuration: ${configFile_postfix}
[ARC]
enabled: no
${cfg.extraConfig}
'';
in
{
options.services.mailman3 = {
enable = mkOption {
type = types.bool;
default = false;
example = true;
description = ''
Wether to enable mailman3 mailing list management system (core).
'';
};
site_owner = mkOption {
type = types.str;
default = "changeme@example.com";
description = ''
mailman3 site owner address.
'';
};
user = mkOption {
type = types.str;
default = "mailman3";
description = ''
User account under which mailman runs.
'';
};
database = {
type = mkOption {
type = types.enum [
"sqlite3"
"mysql"
"postgres"
];
default = "sqlite3";
example = "mysql";
description = ''
Database type to use.
'';
};
host = mkOption {
type = types.str;
default = "172.0.0.1";
description = ''
Database host adress.
'';
};
port = mkOption {
type = types.nullOr types.int;
default = null;
description = ''
'';
};
name = mkOption {
type = types.str;
default = "mailman3";
description = ''
Database name.
'';
};
user = mkOption {
type = types.str;
default = "mailman3";
description = ''
Database user.
'';
};
password = mkOption {
type = types.str;
default = "";
description = ''
The password corresponding to <option>database.user</option>.
Warning: this is stored in cleartext in the Nix store!
Use <option>database.passwordFile</option> instead.
'';
};
passwordFile = mkOption {
type = types.nullOr types.path;
default = null;
example = "/run/keys/mailman3-dbpassword";
description = ''
A file containing the password corresponding to
<option>database.user</option>.
'';
};
socket = mkOption {
type = types.nullOr types.path;
default = null;
example = "/run/mysqld/mysqld.sock";
description = "Path to the unix socket file to use for authentication.";
};
};
paths = {
archive_dir = mkOption {
type = types.str;
default = "${cfg.paths.var_dir}/archives";
description = ''
'';
};
bin_dir = mkOption {
type = types.str;
default = "${mailman3.core}/bin";
description = ''
'';
};
cache_dir = mkOption {
type = types.str;
default = "${cfg.paths.var_dir}/cache";
description = ''
'';
};
data_dir = mkOption {
type = types.str;
default = "${cfg.paths.var_dir}/data";
description = ''
'';
};
etc_dir = mkOption {
type = types.str;
default = "${cfg.paths.var_dir}/etc";
description = ''
'';
};
lock_dir = mkOption {
type = types.str;
default = "${cfg.paths.var_dir}/locks";
description = ''
'';
};
log_dir = mkOption {
type = types.str;
default = "${cfg.paths.var_dir}/logs";
description = ''
'';
};
messages_dir = mkOption {
type = types.str;
default = "${cfg.paths.var_dir}/messages";
description = ''
'';
};
template_dir = mkOption {
type = types.str;
default = "${cfg.paths.var_dir}/templates";
description = ''
'';
};
var_dir = mkOption {
type = types.str;
default = "/var/lib/mailman3";
description = ''
'';
};
lock_file = mkOption {
type = types.path;
default = "${cfg.paths.lock_dir}/master.lck";
description = ''
'';
};
pid_file = mkOption {
type = types.path;
default = "${cfg.paths.var_dir}/master.pid";
description = ''
'';
};
};
mta = {
# TODO: add Sentmail and qmail
type = mkOption {
type = types.enum [
"postfix"
"exim4"
];
default = "postfix";
example = "exim4";
description = ''
Database type to use.
'';
};
incoming = mkOption {
type = types.str;
default = "mailman.mta.${cfg.mta.type}.LMTP";
description = ''
'';
};
outgoing = mkOption {
type = types.str;
default = "mailman.mta.deliver.deliver";
description = ''
'';
};
lmtp_host = mkOption {
type = types.str;
default = "mail.example.com";
description = ''
'';
};
lmtp_port = mkOption {
type = types.int;
default = 8024;
description = ''
'';
};
smtp_host = mkOption {
type = types.str;
default = "mail.example.com";
description = ''
'';
};
smtp_port = mkOption {
type = types.int;
default = 25;
description = ''
'';
};
smtp_user = mkOption {
type = types.str;
default = "";
description = ''
'';
};
smtp_pass = mkOption {
type = types.str;
default = "";
description = ''
'';
};
smtp_passFile = mkOption {
type = types.str;
default = "";
description = ''
'';
};
};
extraConfig = mkOption {
type = types.str;
default = "";
example = ''
[devmode]
enabled: yes
recipient: your.address@your.domain
'';
description = ''
Configuration lines appended to the generated mailman3 configuration file.
'';
};
};
config = mkIf cfg.enable {
users = mkIf (cfg.user == "mailman3") {
users.mailman3 = {
description = "Mailman3 Service";
home = cfg.paths.var_dir;
createHome = true;
useDefaultShell = true;
packages = [ mailman3.core ];
};
};
services.postfix.recipientDelimiter = mkIf usePostfix (mkDefault "+");
services.postfix.mapFiles."transport_maps" = mkIf usePostfix (
mkDefault "${cfg.paths.data_dir}/postfix_lmtp"
);
services.postfix.mapFiles."local_recipient_maps" = mkIf usePostfix (
mkDefault "${cfg.paths.data_dir}/postfix_lmtp"
);
services.postfix.mapFiles."relay_domains" = mkIf usePostfix (
mkDefault "${cfg.paths.data_dir}/postfix_domains"
);
warnings = optional (cfg.database.password != "") ''
config.services.mailman3.database.password will be stored as plaintext
in the Nix store. Use database.passwordFile instead.'';
# Create database passwordFile default when password is configured.
services.mailman3.database.passwordFile = mkDefault (
toString (
pkgs.writeTextFile {
name = "mailman3-database-password";
text = cfg.database.password;
}
)
);
systemd.services.mailman3 = {
description = "GNU Mailing List Manager";
after = [
"network.target"
] ++ lib.optional usePostgresql "postgresql.service" ++ lib.optional useMysql "mysql.service";
wantedBy = [ "multi-user.target" ];
preStart =
let
dbpass = fileContents cfg.database.passwordFile;
smtppass = fileContents cfg.mta.smtp_passFile;
in
''
mkdir -p ${cfg.paths.etc_dir}
cp ${configFile} ${cfg.paths.etc_dir}/mailman.cfg
${optionalString (useMysql || usePostgresql) ''
sed -e "s/#dbpass#/${dbpass}/g" -e "s/#smtppass#/${smtppass}/g" -i ${cfg.paths.etc_dir}/mailman.cfg
''}
chmod 640 ${cfg.paths.etc_dir}/mailman.cfg
'';
serviceConfig = {
Type = "forking";
User = cfg.user;
WorkingDirectory = cfg.paths.var_dir;
ExecStart = "${mailman3.core}/bin/mailman start -f";
ExecReload = "${mailman3.core}/bin/mailman restart";
ExecStop = "${mailman3.core}/bin/mailman stop";
};
environment = {
USER = cfg.user;
HOME = cfg.paths.var_dir;
MAILMAN_CONFIG_FILE = "${cfg.paths.etc_dir}/mailman.cfg";
};
};
};
}

View file

@ -1,41 +0,0 @@
{
pkgs ? import <nixpkgs> { },
python3Packages ? pkgs.python3Packages,
}:
let
mailman3 = {
core = python3Packages.callPackage ./core.nix (
with deps;
{
inherit
aiosmtpd
atpublic
flufl_bounce
flufl_i18n
flufl_lock
lazr_config
;
}
);
};
deps = rec {
aiosmtpd = python3Packages.callPackage ./extraPackages/aiosmtpd.nix {
inherit atpublic;
};
atpublic = python3Packages.callPackage ./extraPackages/atpublic.nix { };
flufl_bounce = python3Packages.callPackage ./extraPackages/flufl_bounce.nix {
inherit atpublic;
};
flufl_i18n = python3Packages.callPackage ./extraPackages/flufl_i18n.nix {
inherit atpublic;
};
flufl_lock = python3Packages.callPackage ./extraPackages/flufl_lock.nix {
inherit atpublic;
};
lazr_config = python3Packages.callPackage ./extraPackages/lazr_config.nix {
inherit lazr_delegates;
};
lazr_delegates = python3Packages.callPackage ./extraPackages/lazr_delegates.nix { };
};
in
mailman3