summary refs log tree commit diff
path: root/pkgs/servers/mail/mailman/web.nix
blob: da352ed3482d0709e389efd1ac54a49d837d8383 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{ stdenv
, serverEMail ? "postmaster@example.org"
, archiverKey ? "SecretArchiverAPIKey"
, allowedHosts ? []
}:

let

  allowedHostsString = stdenv.lib.concatMapStringsSep ", " (x: "\""+x+"\"") allowedHosts;

in

stdenv.mkDerivation {
  name = "mailman-web-0";

  unpackPhase = ":";

  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 \
      --subst-var-by SERVER_EMAIL '${serverEMail}' \
      --subst-var-by ARCHIVER_KEY '${archiverKey}' \
      --subst-var-by ALLOWED_HOSTS '${allowedHostsString}'
    chmod 444 $out/settings.py
  '';
}