Format project using nixfmt rfc candidate.
This commit is contained in:
parent
1f63817684
commit
a9f7fe416f
91 changed files with 1347 additions and 1000 deletions
|
@ -6,32 +6,40 @@
|
|||
...
|
||||
}:
|
||||
with lib;
|
||||
{
|
||||
imports = [
|
||||
mailserver.nixosModules.mailserver
|
||||
];
|
||||
}
|
||||
// mkIf (elem "mailserver" config.machine.services) {
|
||||
mailserver = let
|
||||
{
|
||||
imports = [
|
||||
mailserver.nixosModules.mailserver
|
||||
];
|
||||
}
|
||||
// mkIf (elem "mailserver" config.machine.services) {
|
||||
mailserver =
|
||||
let
|
||||
cfg = config.machine;
|
||||
inherit (cfg) domain;
|
||||
fdomain = (findFirst (s: s.service == "mail") cfg cfg.vHosts).domain;
|
||||
mkFqdnAlias = name: ["${name}@${domain}" "${name}@${fdomain}"];
|
||||
mkFqdnAlias = name: [
|
||||
"${name}@${domain}"
|
||||
"${name}@${fdomain}"
|
||||
];
|
||||
mkExDomAlias = name: (map (exDom: "${name}@${exDom}") cfg.extraDomains);
|
||||
mkUser = user: rec {
|
||||
name = "${user.name}@${domain}";
|
||||
value = {
|
||||
hashedPasswordFile = config.sops.secrets."users/${user.name}/mail".path;
|
||||
aliases =
|
||||
["${user.name}@${fdomain}"]
|
||||
[ "${user.name}@${fdomain}" ]
|
||||
++ (flatten (map mkFqdnAlias user.aliases))
|
||||
++ (flatten (map mkExDomAlias ([user.name] ++ user.aliases)));
|
||||
++ (flatten (map mkExDomAlias ([ user.name ] ++ user.aliases)));
|
||||
};
|
||||
};
|
||||
in rec {
|
||||
in
|
||||
rec {
|
||||
enable = true;
|
||||
fqdn = fdomain;
|
||||
domains = [fdomain domain] ++ cfg.extraDomains;
|
||||
domains = [
|
||||
fdomain
|
||||
domain
|
||||
] ++ cfg.extraDomains;
|
||||
loginAccounts = listToAttrs (map mkUser cfg.mailAccounts);
|
||||
|
||||
# Use Let's Encrypt certificates. Note that this needs to set up a stripped
|
||||
|
@ -55,9 +63,5 @@ with lib;
|
|||
# 1 Gb RAM for the server. Without virus scanning 256 MB RAM should be plenty)
|
||||
virusScanning = false;
|
||||
};
|
||||
sops.secrets =
|
||||
fn.sopsHelper
|
||||
(user: "users/${user.name}/mail")
|
||||
config.machine.mailAccounts
|
||||
{};
|
||||
}
|
||||
sops.secrets = fn.sopsHelper (user: "users/${user.name}/mail") config.machine.mailAccounts { };
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue