Merge branch 'master' of https://github.com/Infinisil/nixos-mailserver into module-rewrite
This commit is contained in:
commit
b0ae2de5f4
6 changed files with 292 additions and 180 deletions
|
@ -17,7 +17,7 @@
|
|||
{ domain, host_prefix, enable_imap, enable_pop3 }:
|
||||
|
||||
{
|
||||
hostName = "${host_prefix}.${domain}";
|
||||
#hostName = "${host_prefix}.${domain}";
|
||||
|
||||
firewall = {
|
||||
enable = true;
|
||||
|
|
|
@ -14,22 +14,18 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
{ mail_dir, domain, valiases, cert, key }:
|
||||
{ lib, mail_dir, domain, valiases, cert, key }:
|
||||
|
||||
let
|
||||
# valiasToString :: { from = "..."; to = "..." } -> String
|
||||
valiasToString = x: "${x.from}@${domain} ${x.to}@${domain}\n";
|
||||
|
||||
# valiases_postfix :: [ String ]
|
||||
valiases_postfix = map valiasToString valiases;
|
||||
|
||||
# concatString :: [ String ] -> String
|
||||
concatString = l: if l == []
|
||||
then ""
|
||||
else (builtins.head l) + (concatString (builtins.tail l));
|
||||
valiases_postfix = map
|
||||
(from:
|
||||
let to = valiases.${from};
|
||||
in "${from}@${domain} ${to}@${domain}")
|
||||
(builtins.attrNames valiases);
|
||||
|
||||
# valiases_file :: Path
|
||||
valiases_file = builtins.toFile "valias" (concatString valiases_postfix);
|
||||
valiases_file = builtins.toFile "valias" (lib.concatStringsSep "\n" valiases_postfix);
|
||||
|
||||
# vhosts_file :: Path
|
||||
vhosts_file = builtins.toFile "vhosts" domain;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
{ mail_dir, vmail_user_name, vmail_group_name, valiases, domain, enable_imap,
|
||||
{ lib, mail_dir, vmail_user_name, vmail_group_name, valiases, domain, enable_imap,
|
||||
enable_pop3, virus_scanning, dkim_signing, dkim_selector, dkim_dir,
|
||||
certificate_scheme, cert_file, key_file, cert_dir }:
|
||||
|
||||
|
@ -44,7 +44,7 @@ in
|
|||
};
|
||||
|
||||
postfix = import ./postfix.nix {
|
||||
inherit mail_dir domain valiases cert key;
|
||||
inherit lib mail_dir domain valiases cert key;
|
||||
};
|
||||
|
||||
dovecot2 = import ./dovecot.nix {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
{ vmail_id_start, vmail_user_name, vmail_group_name, domain, mail_dir,
|
||||
{ lib, vmail_id_start, vmail_user_name, vmail_group_name, domain, mail_dir,
|
||||
login_accounts }:
|
||||
|
||||
let
|
||||
|
@ -28,15 +28,15 @@ let
|
|||
}];
|
||||
|
||||
# accountsToUser :: String -> UserRecord
|
||||
accountsToUser = x: {
|
||||
name = x.name + "@" + domain;
|
||||
accountsToUser = account: {
|
||||
name = account.name + "@" + domain;
|
||||
isNormalUser = false;
|
||||
group = vmail_group_name;
|
||||
hashedPassword = x.password;
|
||||
inherit (account) hashedPassword;
|
||||
};
|
||||
|
||||
# mail_user :: [ UserRecord ]
|
||||
mail_user = map accountsToUser login_accounts;
|
||||
mail_user = map accountsToUser (lib.attrValues login_accounts);
|
||||
|
||||
in
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue