Start migrating to NixOS mailman3 service.
This commit is contained in:
parent
3791e05369
commit
47b88cfd35
4 changed files with 80 additions and 0 deletions
|
@ -7,6 +7,7 @@
|
||||||
./hydra.nix
|
./hydra.nix
|
||||||
./mailserver/default.nix
|
./mailserver/default.nix
|
||||||
./mailserver.nix
|
./mailserver.nix
|
||||||
|
./mailman3.nix
|
||||||
./mariaDB.nix
|
./mariaDB.nix
|
||||||
./nextcloud.nix
|
./nextcloud.nix
|
||||||
./nginx.nix
|
./nginx.nix
|
||||||
|
|
53
services/mailman3.nix
Normal file
53
services/mailman3.nix
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.machine;
|
||||||
|
in mkIf (elem "mailman3" config.machine.services) {
|
||||||
|
services.mailman = {
|
||||||
|
enable = true;
|
||||||
|
hyperkittyApiKey = (fileContents "${cfg.secretPath}/hyperkittyApiKey");
|
||||||
|
hyperkittyBaseUrl = (findFirst (s: s.service == "hyperkitty") cfg cfg.vHosts).domain;
|
||||||
|
siteOwner = "postmaster@${cfg.domain}";
|
||||||
|
# webHosts = [];
|
||||||
|
};
|
||||||
|
|
||||||
|
services.uwsgi = {
|
||||||
|
enable = true;
|
||||||
|
plugins = [ "python3" ];
|
||||||
|
user = "nginx";
|
||||||
|
group = "nginx";
|
||||||
|
instance = {
|
||||||
|
type = "emperor";
|
||||||
|
vassals = {
|
||||||
|
mailman-web = {
|
||||||
|
type = "normal";
|
||||||
|
plugin = "python3";
|
||||||
|
pythonPackages = self: with self; [
|
||||||
|
django-mailman3 postorius
|
||||||
|
];
|
||||||
|
# module = "mailman-web.wsgi";
|
||||||
|
socket = "${config.services.uwsgi.runDir}/mailman-web.sock";
|
||||||
|
wsgi-file = "wsgi.py";
|
||||||
|
chdir = config.services.mailman.webRoot;
|
||||||
|
logger = "file:/var/log/uwsgi/mailman-web-error.log";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# have to override some stuff because whoever wrote the submodule didn't think about shit when he/she wrote it >.<
|
||||||
|
# TODO:
|
||||||
|
# - write a PR for nixpkgs to fix this stuff
|
||||||
|
# - /var/lib/mailman-web does not exist by default, should be added by the submodule
|
||||||
|
# - the API key should not be public (even for local users (even worse if your store is public (in case of hosting a binary cache)))
|
||||||
|
systemd.services.mailman-web.serviceConfig.User = mkForce "nginx";
|
||||||
|
systemd.services.hyperkitty.serviceConfig.User = mkForce "nginx";
|
||||||
|
systemd.services.hyperkitty-minutely.serviceConfig.User = mkForce "nginx";
|
||||||
|
systemd.services.hyperkitty-quarter-hourly.serviceConfig.User = mkForce "nginx";
|
||||||
|
systemd.services.hyperkitty-hourly.serviceConfig.User = mkForce "nginx";
|
||||||
|
systemd.services.hyperkitty-daily.serviceConfig.User = mkForce "nginx";
|
||||||
|
systemd.services.hyperkitty-weekly.serviceConfig.User = mkForce "nginx";
|
||||||
|
systemd.services.hyperkitty-yearly.serviceConfig.User = mkForce "nginx";
|
||||||
|
}
|
9
services/nginx_vHosts/hyperkitty.nix
Normal file
9
services/nginx_vHosts/hyperkitty.nix
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
{
|
||||||
|
vHost = {
|
||||||
|
root = "/var/www";
|
||||||
|
};
|
||||||
|
}.vHost
|
17
services/nginx_vHosts/mailman3.nix
Normal file
17
services/nginx_vHosts/mailman3.nix
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{ pkgs, config, lib, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
{
|
||||||
|
vHost = if config.services.mailman.enable then {
|
||||||
|
locations = {
|
||||||
|
"/static/".extraConfig = ''
|
||||||
|
alias /var/lib/mailman-web;
|
||||||
|
'';
|
||||||
|
"/".extraConfig = ''
|
||||||
|
uwsgi_pass unix://${config.services.uwsgi.runDir}/mailman-web.sock;
|
||||||
|
include ${pkgs.nginx}/conf/uwsgi_params;
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
} else {};
|
||||||
|
}.vHost
|
Loading…
Reference in a new issue