about summary refs log tree commit diff
path: root/pkgs/servers/mail
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2020-01-09 21:12:59 +0000
committerAlyssa Ross <hi@alyssa.is>2020-01-30 23:14:45 +0000
commita8538a73a782779ce6e4191c779de470f938d5fd (patch)
tree1d4941ea31cfe253dcc6ef403904672d6ea96d93 /pkgs/servers/mail
parent8d9636e092779c8ceb4a7b64ed20dbed43101713 (diff)
downloadnixlib-a8538a73a782779ce6e4191c779de470f938d5fd.tar
nixlib-a8538a73a782779ce6e4191c779de470f938d5fd.tar.gz
nixlib-a8538a73a782779ce6e4191c779de470f938d5fd.tar.bz2
nixlib-a8538a73a782779ce6e4191c779de470f938d5fd.tar.lz
nixlib-a8538a73a782779ce6e4191c779de470f938d5fd.tar.xz
nixlib-a8538a73a782779ce6e4191c779de470f938d5fd.tar.zst
nixlib-a8538a73a782779ce6e4191c779de470f938d5fd.zip
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.
Diffstat (limited to 'pkgs/servers/mail')
-rw-r--r--pkgs/servers/mail/mailman/default.nix9
-rw-r--r--pkgs/servers/mail/mailman/wrapped.nix20
2 files changed, 23 insertions, 6 deletions
diff --git a/pkgs/servers/mail/mailman/default.nix b/pkgs/servers/mail/mailman/default.nix
index 8e763800f650..d6b73aea3da5 100644
--- a/pkgs/servers/mail/mailman/default.nix
+++ b/pkgs/servers/mail/mailman/default.nix
@@ -28,15 +28,12 @@ buildPythonPackage rec {
   '';
 
   # 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
-  # to create a specialized python interpreter:
-  #
-  #   python37.withPackages (ps: [ps.mailman])
+  # them in shell code breaks this assumption. Use the wrapped version (see
+  # wrapped.nix) if you need the CLI (rather than the Python library).
   #
   # This gives a properly wrapped 'mailman' command plus an interpreter that
   # has all the necessary search paths to execute unwrapped 'master' and
-  # 'runner' scripts. The setup is a little tricky, but fortunately NixOS is
-  # about to get a OS module that takes care of those details.
+  # 'runner' scripts.
   dontWrapPythonPrograms = true;
 
   meta = {
diff --git a/pkgs/servers/mail/mailman/wrapped.nix b/pkgs/servers/mail/mailman/wrapped.nix
new file mode 100644
index 000000000000..2a620763d876
--- /dev/null
+++ b/pkgs/servers/mail/mailman/wrapped.nix
@@ -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
+''