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.
This commit is contained in:
parent
8d9636e092
commit
a8538a73a7
|
@ -6,19 +6,6 @@ let
|
||||||
|
|
||||||
cfg = config.services.mailman;
|
cfg = config.services.mailman;
|
||||||
|
|
||||||
mailmanPyEnv = pkgs.python3.withPackages (ps: with ps; [mailman mailman-hyperkitty]);
|
|
||||||
|
|
||||||
mailmanExe = with pkgs; stdenv.mkDerivation {
|
|
||||||
name = "mailman-" + python3Packages.mailman.version;
|
|
||||||
buildInputs = [makeWrapper];
|
|
||||||
unpackPhase = ":";
|
|
||||||
installPhase = ''
|
|
||||||
mkdir -p $out/bin
|
|
||||||
makeWrapper ${mailmanPyEnv}/bin/mailman $out/bin/mailman \
|
|
||||||
--set MAILMAN_CONFIG_FILE /etc/mailman.cfg
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
mailmanWeb = pkgs.python3Packages.mailman-web.override {
|
mailmanWeb = pkgs.python3Packages.mailman-web.override {
|
||||||
serverEMail = cfg.siteOwner;
|
serverEMail = cfg.siteOwner;
|
||||||
archiverKey = cfg.hyperkittyApiKey;
|
archiverKey = cfg.hyperkittyApiKey;
|
||||||
|
@ -189,7 +176,7 @@ in {
|
||||||
users.users.mailman = { description = "GNU Mailman"; isSystemUser = true; };
|
users.users.mailman = { description = "GNU Mailman"; isSystemUser = true; };
|
||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
systemPackages = [ mailmanExe mailmanWebExe pkgs.sassc ];
|
systemPackages = [ pkgs.mailman mailmanWebExe pkgs.sassc ];
|
||||||
etc."mailman.cfg".text = mailmanCfg;
|
etc."mailman.cfg".text = mailmanCfg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -205,8 +192,8 @@ in {
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${mailmanExe}/bin/mailman start";
|
ExecStart = "${pkgs.mailman}/bin/mailman start";
|
||||||
ExecStop = "${mailmanExe}/bin/mailman stop";
|
ExecStop = "${pkgs.mailman}/bin/mailman stop";
|
||||||
User = "mailman";
|
User = "mailman";
|
||||||
Type = "forking";
|
Type = "forking";
|
||||||
RuntimeDirectory = "mailman";
|
RuntimeDirectory = "mailman";
|
||||||
|
@ -271,7 +258,7 @@ in {
|
||||||
description = "Trigger daily Mailman events";
|
description = "Trigger daily Mailman events";
|
||||||
startAt = "daily";
|
startAt = "daily";
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${mailmanExe}/bin/mailman digests --send";
|
ExecStart = "${pkgs.mailman}/bin/mailman digests --send";
|
||||||
User = "mailman";
|
User = "mailman";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -28,15 +28,12 @@ buildPythonPackage rec {
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Mailman assumes that those scripts in $out/bin are Python scripts. Wrapping
|
# Mailman assumes that those scripts in $out/bin are Python scripts. Wrapping
|
||||||
# them in shell code breaks this assumption. The proper way to use mailman is
|
# them in shell code breaks this assumption. Use the wrapped version (see
|
||||||
# to create a specialized python interpreter:
|
# wrapped.nix) if you need the CLI (rather than the Python library).
|
||||||
#
|
|
||||||
# python37.withPackages (ps: [ps.mailman])
|
|
||||||
#
|
#
|
||||||
# This gives a properly wrapped 'mailman' command plus an interpreter that
|
# This gives a properly wrapped 'mailman' command plus an interpreter that
|
||||||
# has all the necessary search paths to execute unwrapped 'master' and
|
# has all the necessary search paths to execute unwrapped 'master' and
|
||||||
# 'runner' scripts. The setup is a little tricky, but fortunately NixOS is
|
# 'runner' scripts.
|
||||||
# about to get a OS module that takes care of those details.
|
|
||||||
dontWrapPythonPrograms = true;
|
dontWrapPythonPrograms = true;
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
{ runCommand, lib, makeWrapper, python3
|
||||||
|
, archivers ? [ python3.pkgs.mailman-hyperkitty ]
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (python3.pkgs) makePythonPath mailman;
|
||||||
|
in
|
||||||
|
|
||||||
|
runCommand "${mailman.name}-wrapped" {
|
||||||
|
inherit (mailman) meta;
|
||||||
|
buildInputs = [ makeWrapper ];
|
||||||
|
passthru = mailman.passthru // { unwrapped = mailman; };
|
||||||
|
} ''
|
||||||
|
mkdir -p "$out/bin"
|
||||||
|
cd "${mailman}/bin"
|
||||||
|
for exe in *; do
|
||||||
|
makeWrapper "${mailman}/bin/$exe" "$out/bin/$exe" \
|
||||||
|
--set PYTHONPATH ${makePythonPath ([ mailman ] ++ archivers)}
|
||||||
|
done
|
||||||
|
''
|
|
@ -15321,6 +15321,8 @@ in
|
||||||
|
|
||||||
labelImg = callPackage ../applications/science/machine-learning/labelimg { };
|
labelImg = callPackage ../applications/science/machine-learning/labelimg { };
|
||||||
|
|
||||||
|
mailman = callPackage ../servers/mail/mailman/wrapped.nix { };
|
||||||
|
|
||||||
mailman-rss = callPackage ../development/python-modules/mailman-rss { };
|
mailman-rss = callPackage ../development/python-modules/mailman-rss { };
|
||||||
|
|
||||||
mattermost = callPackage ../servers/mattermost { };
|
mattermost = callPackage ../servers/mattermost { };
|
||||||
|
|
Loading…
Reference in New Issue