summary refs log tree commit diff
path: root/pkgs/servers/mail
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2019-09-11 14:48:51 +0200
committerPeter Simons <simons@cryp.to>2019-09-11 14:48:51 +0200
commit86f8895abbfdb3ce118e0ca971f56c7f72871e29 (patch)
tree089ec6284d12284781593fce0ea7b1a30b06d749 /pkgs/servers/mail
parent72c7ba5aba1d8dde9da8f4e7b5805edb30cbad7b (diff)
downloadnixpkgs-86f8895abbfdb3ce118e0ca971f56c7f72871e29.tar
nixpkgs-86f8895abbfdb3ce118e0ca971f56c7f72871e29.tar.gz
nixpkgs-86f8895abbfdb3ce118e0ca971f56c7f72871e29.tar.bz2
nixpkgs-86f8895abbfdb3ce118e0ca971f56c7f72871e29.tar.lz
nixpkgs-86f8895abbfdb3ce118e0ca971f56c7f72871e29.tar.xz
nixpkgs-86f8895abbfdb3ce118e0ca971f56c7f72871e29.tar.zst
nixpkgs-86f8895abbfdb3ce118e0ca971f56c7f72871e29.zip
python-mailman-web: turn these Djando configuration files into a make-shift Python library
Suggested in https://github.com/NixOS/nixpkgs/pull/67951#issuecomment-530309702.
Diffstat (limited to 'pkgs/servers/mail')
-rw-r--r--pkgs/servers/mail/mailman/web.nix22
1 files changed, 16 insertions, 6 deletions
diff --git a/pkgs/servers/mail/mailman/web.nix b/pkgs/servers/mail/mailman/web.nix
index da352ed3482..b0ead765a60 100644
--- a/pkgs/servers/mail/mailman/web.nix
+++ b/pkgs/servers/mail/mailman/web.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ stdenv, python, hyperkitty, postorius, buildPythonPackage
 , serverEMail ? "postmaster@example.org"
 , archiverKey ? "SecretArchiverAPIKey"
 , allowedHosts ? []
@@ -10,18 +10,28 @@ let
 
 in
 
-stdenv.mkDerivation {
+# We turn those Djando configuration files into a make-shift Python library so
+# that Nix users can use this package as a part of their buildInputs to import
+# the code. Also, this package implicitly provides an environment in which the
+# Django app can be run.
+
+buildPythonPackage {
   name = "mailman-web-0";
 
+  propagatedBuildInputs = [ hyperkitty postorius ];
+
   unpackPhase = ":";
+  buildPhase = ":";
+  setuptoolsCheckPhase = ":";
 
   installPhase = ''
-    install -D -m 444 ${./urls.py} $out/urls.py
-    install -D -m 444 ${./wsgi.py} $out/wsgi.py
-    substitute ${./settings.py} $out/settings.py \
+    d=$out/${python.sitePackages}
+    install -D -m 444 ${./urls.py} $d/urls.py
+    install -D -m 444 ${./wsgi.py} $d/wsgi.py
+    substitute ${./settings.py} $d/settings.py \
       --subst-var-by SERVER_EMAIL '${serverEMail}' \
       --subst-var-by ARCHIVER_KEY '${archiverKey}' \
       --subst-var-by ALLOWED_HOSTS '${allowedHostsString}'
-    chmod 444 $out/settings.py
+    chmod 444 $d/settings.py
   '';
 }