I am a bit confused about mkOptionType
. Ok, I get that it is used to define custom types for the NixOS DSL. I’d like to understand how that works in the case of simple-nixos-mailserver / nixos-mailserver · GitLab.
I can see:
loginAccount = mkOptionType {
name = "Login Account";
};
or to give you some context
loginAccounts = mkOption {
type = types.attrsOf (types.submodule ({ name, ... }: {
options = {
name = mkOption {
type = types.str;
example = "user1@example.com";
description = "Username";
};
[...]
extraVirtualAliases = mkOption {
type = let
loginAccount = mkOptionType {
name = "Login Account";
check = (account: builtins.elem account (builtins.attrNames cfg.loginAccounts));
};
in with types; attrsOf (either loginAccount (nonEmptyListOf loginAccount));
example = {
"info@example.com" = "user1@example.com";
"postmaster@example.com" = "user1@example.com";
"abuse@example.com" = "user1@example.com";
"multi@example.com" = [ "user1@example.com" "user2@example.com" ];
};
description = ''
Virtual Aliases. A virtual alias `"info@example.com" = "user1@example.com"` means that
all mail to `info@example.com` is forwarded to `user1@example.com`. Note
that it is expected that `postmaster@example.com` and `abuse@example.com` is
forwarded to some valid email address. (Alternatively you can create login
accounts for `postmaster` and (or) `abuse`). Furthermore, it also allows
the user `user1@example.com` to send emails as `info@example.com`.
It's also possible to create an alias for multiple accounts. In this
example all mails for `multi@example.com` will be forwarded to both
`user1@example.com` and `user2@example.com`.
'';
default = {};
};
where is this type Login Account
used at all? I mean there is some loginAccounts
but how does that fit together?