make users into module

This commit is contained in:
Robin Raymond 2017-09-02 13:58:42 +02:00
parent ebb2a5caf7
commit 26ac134660
2 changed files with 13 additions and 14 deletions

View File

@ -249,6 +249,7 @@ in
imports = [ imports = [
./mail-server/clamav.nix ./mail-server/clamav.nix
./mail-server/users.nix
]; ];
config = mkIf cfg.enable { config = mkIf cfg.enable {
@ -275,11 +276,5 @@ in
hostPrefix domain dkimSelector dkimKeyDirectory; hostPrefix domain dkimSelector dkimKeyDirectory;
}; };
users = import ./mail-server/users.nix {
inherit lib;
inherit (cfg) vmailUIDStart vmailUserName vmailGroupName domain
mailDirectory
loginAccounts;
};
}; };
} }

View File

@ -14,8 +14,9 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/> # along with this program. If not, see <http://www.gnu.org/licenses/>
{ lib, vmailUIDStart, vmailUserName, vmailGroupName, domain, mailDirectory, { config, pkgs, lib, ... }:
loginAccounts }:
with config.mailserver;
let let
vmail_user = [{ vmail_user = [{
@ -40,11 +41,14 @@ let
in in
{ {
# set the vmail gid to a specific value
groups = {
vmail = { gid = vmailUIDStart; };
};
# define all users config = lib.mkIf enable {
extraUsers = vmail_user ++ mail_user; # set the vmail gid to a specific value
users.groups = {
vmail = { gid = vmailUIDStart; };
};
# define all users
users.extraUsers = vmail_user ++ mail_user;
};
} }