2019-09-11 13:48:51 +01:00
|
|
|
{ stdenv, python, hyperkitty, postorius, buildPythonPackage
|
2019-09-01 19:33:47 +01:00
|
|
|
, serverEMail ? "postmaster@example.org"
|
|
|
|
, archiverKey ? "SecretArchiverAPIKey"
|
|
|
|
, allowedHosts ? []
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
allowedHostsString = stdenv.lib.concatMapStringsSep ", " (x: "\""+x+"\"") allowedHosts;
|
|
|
|
|
|
|
|
in
|
|
|
|
|
2019-09-11 13:48:51 +01:00
|
|
|
# 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 {
|
2019-09-01 19:33:47 +01:00
|
|
|
name = "mailman-web-0";
|
|
|
|
|
2019-09-11 13:48:51 +01:00
|
|
|
propagatedBuildInputs = [ hyperkitty postorius ];
|
|
|
|
|
2019-09-01 19:33:47 +01:00
|
|
|
unpackPhase = ":";
|
2019-09-11 13:48:51 +01:00
|
|
|
buildPhase = ":";
|
|
|
|
setuptoolsCheckPhase = ":";
|
2019-09-01 19:33:47 +01:00
|
|
|
|
|
|
|
installPhase = ''
|
2019-09-11 13:48:51 +01:00
|
|
|
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 \
|
2019-09-01 19:33:47 +01:00
|
|
|
--subst-var-by SERVER_EMAIL '${serverEMail}' \
|
|
|
|
--subst-var-by ARCHIVER_KEY '${archiverKey}' \
|
|
|
|
--subst-var-by ALLOWED_HOSTS '${allowedHostsString}'
|
2019-09-11 13:48:51 +01:00
|
|
|
chmod 444 $d/settings.py
|
2019-09-01 19:33:47 +01:00
|
|
|
'';
|
|
|
|
}
|