mailsystem: Add vmail user and group configuration
This commit is contained in:
parent
9180d7345c
commit
56feea5754
2 changed files with 47 additions and 0 deletions
|
|
@ -13,9 +13,34 @@
|
||||||
example = "mail.example.com";
|
example = "mail.example.com";
|
||||||
description = "Fully qualified domain name of the mail server.";
|
description = "Fully qualified domain name of the mail server.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
vmailUID = lib.mkOption {
|
||||||
|
type = lib.types.int;
|
||||||
|
default = 5000;
|
||||||
|
description = "The unix UID of the virtual mail user.";
|
||||||
|
};
|
||||||
|
|
||||||
|
vmailUserName = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "vmail";
|
||||||
|
description = "The user name of the user that owns the directory all the mail is stored.";
|
||||||
|
};
|
||||||
|
|
||||||
|
vmailGroupName = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "vmail";
|
||||||
|
description = "The group name of the user that owns the directory all the mail is stored.";
|
||||||
|
};
|
||||||
|
|
||||||
|
mailDirectory = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "/var/vmail";
|
||||||
|
description = "Storage location for all mail.";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
./nginx.nix
|
./nginx.nix
|
||||||
|
./user.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
22
mailsystem/user.nix
Normal file
22
mailsystem/user.nix
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
cfg = config.mailsystem;
|
||||||
|
in {
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
users.users."${cfg.vmailUserName}" = {
|
||||||
|
uid = cfg.vmailUID;
|
||||||
|
isSystemUser = true;
|
||||||
|
group = cfg.vmailGroupName;
|
||||||
|
home = cfg.mailDirectory;
|
||||||
|
createHome = true;
|
||||||
|
description = "Virtual Mail User";
|
||||||
|
};
|
||||||
|
|
||||||
|
users.groups."${cfg.vmailGroupName}" = {
|
||||||
|
gid = cfg.vmailUID;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue