diff options
author | Robin Raymond <robin@robinraymond.de> | 2018-02-18 12:17:32 +0100 |
---|---|---|
committer | Robin Raymond <robin@robinraymond.de> | 2018-02-18 12:17:32 +0100 |
commit | 436cf0513b624b9210ce5e71066ed006a4287f09 (patch) | |
tree | cc3d973b4de242cac6a12a78269b80c29e342ae5 /mail-server/common.nix | |
parent | 3c625fc1911399dac8906e177358e9d94940a0d5 (diff) | |
parent | 3b9b7961d4c6199198cf8f35678daf14648e62d9 (diff) |
add vitual mail users
Diffstat (limited to 'mail-server/common.nix')
-rw-r--r-- | mail-server/common.nix | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/mail-server/common.nix b/mail-server/common.nix index c1741e3..7e968d9 100644 --- a/mail-server/common.nix +++ b/mail-server/common.nix @@ -14,10 +14,17 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> -{ config }: +{ config, lib }: let cfg = config.mailserver; + # passwd :: [ String ] + passwd = lib.mapAttrsToList + (name: value: "${name}:${value.hashedPassword}:${builtins.toString cfg.vmailUID}:${builtins.toString cfg.vmailUID}::${cfg.mailDirectory}:/run/current-system/sw/bin/nologin:" + + (if lib.isString value.quota + then "userdb_quota_rule=*:storage=${value.quota}" + else "")) + cfg.loginAccounts; in { # cert :: PATH @@ -37,4 +44,7 @@ in else if cfg.certificateScheme == 3 then "/var/lib/acme/${cfg.fqdn}/key.pem" else throw "Error: Certificate Scheme must be in { 1, 2, 3 }"; + + # passwdFile :: PATH + passwdFile = builtins.toFile "passwd" (lib.concatStringsSep "\n" passwd); } |