nixos-config/config/host-config/france/webmail.nix
2021-11-05 07:06:08 -07:00

100 lines
2.5 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
let
hostname = config.instance.hostname;
domain-name = config.instance.local-domain;
site-name = config.instance.local-site;
secrets = config.fudo.secrets.host-secrets.${hostname};
# TODO: what should go here?
static = ../../../static;
cfg = config.fudo.france.webmail;
db-passwd = pkgs.lib.fudo.passwd.random-passwd-file "webmail" 40;
in {
options.fudo.france.webmail = with types; {
mail-server = mkOption {
type = str;
description = "Mail server to use for webmail.";
};
database = {
hostname = mkOption {
type = str;
description = "PostgreSQL server.";
};
};
};
config.fudo = {
webmail = {
enable = true;
sites = {
"webmail.fudo.link" = {
title = "Fudo Link Webmail";
favicon = "${static}/fudo.link/favicon.ico";
mail-server = cfg.mail-server;
domain = "fudo.link";
edit-mode = "Plain";
layout-mode = "bottom";
database = {
hostname = cfg.database.hostname;
password-file = db-passwd;
};
};
"webmail.test.fudo.org" = {
title = "Fudo Webmail";
favicon = "${static}/fudo.org/favicon.ico";
mail-server = cfg.mail-server;
domain = "fudo.org";
edit-mode = "Plain";
database = {
hostname = cfg.database.hostname;
password-file = db-passwd;
};
};
"webmail.fudo.org" = {
title = "Fudo Webmail";
favicon = "${static}/fudo.org/favicon.ico";
mail-server = cfg.mail-server;
domain = "fudo.org";
edit-mode = "Plain";
database = {
hostname = cfg.database.hostname;
password-file = db-passwd;
};
};
"webmail.test.selby.ca" = {
title = "Selby Webmail";
favicon = "${static}/selby.ca/favicon.ico";
mail-server = cfg.mail-server;
domain = "selby.ca";
database = {
hostname = cfg.database.hostname;
password-file = db-passwd;
};
};
"webmail.selby.ca" = {
title = "Selby Webmail";
favicon = "${static}/selby.ca/favicon.ico";
mail-server = cfg.mail-server;
domain = "selby.ca";
database = {
hostname = cfg.database.hostname;
password-file = db-passwd;
};
};
};
};
};
}