fix(email options)
This commit is contained in:
@@ -186,5 +186,58 @@ with lib;
|
|||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#################
|
||||||
|
# Email #
|
||||||
|
#################
|
||||||
|
email = with lib; mkOption {
|
||||||
|
type = types.attrsOf (
|
||||||
|
types.submodule (
|
||||||
|
{ name, ... }: {
|
||||||
|
options = {
|
||||||
|
subdomain = mkOption {
|
||||||
|
type = with types; strMatching "[A-Za-z0-9][A-Za-z0-9\-]{0,61}[A-Za-z0-9]";
|
||||||
|
example = "myservice";
|
||||||
|
default = config.sp.domain;
|
||||||
|
description = "Email subdomain";
|
||||||
|
};
|
||||||
|
|
||||||
|
systemdTargets = mkOption {
|
||||||
|
type = with types; listOf strMatchig "[a-zA-Z0-9@%:_.\-]+[.](service|socket|device|mount|automount|swap|target|path|timer|scope|slice)";
|
||||||
|
default = [];
|
||||||
|
example = [ "generate-mastodon-email-password.service" ];
|
||||||
|
description = "Systemd target which generates password file.";
|
||||||
|
};
|
||||||
|
|
||||||
|
sendOnly = mkOption {
|
||||||
|
type = with types; bool;
|
||||||
|
default = true;
|
||||||
|
example = "false";
|
||||||
|
description = "Specifies if the account should be a send-only account. Emails sent to send-only accounts will be rejected.";
|
||||||
|
};
|
||||||
|
|
||||||
|
hashedPasswordFile = mkOption {
|
||||||
|
type = with types; str;
|
||||||
|
example = "/run/keys/mastodon/email_password";
|
||||||
|
description = "Path where a file containing password hash located.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
description = ''
|
||||||
|
Don't use this option to create regular users!!!
|
||||||
|
|
||||||
|
This option gives modules possibility to create mailboxes to send emails, e.g. notifications or reminders.
|
||||||
|
'';
|
||||||
|
|
||||||
|
example = {
|
||||||
|
"noreply@mastodon.example.tld" = {
|
||||||
|
hashedPasswordFile = "/run/keys/mastodon/email_password";
|
||||||
|
systemdTargets = [ "generate-mastodon-email-password.service" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -22,9 +22,9 @@ let
|
|||||||
_: value: {
|
_: value: {
|
||||||
inherit (value) hashedPasswordFile sendOnly;
|
inherit (value) hashedPasswordFile sendOnly;
|
||||||
}
|
}
|
||||||
) config.sp.email;
|
) sp.email;
|
||||||
extraDomains = lib.mapAttrsToList (_: value: value.subdomain) config.sp.email;
|
extraDomains = lib.mapAttrsToList (_: value: value.subdomain) sp.email;
|
||||||
extraTargets = lib.mapAttrsToList (_: value: value.systemdTargets) config.sp.email;
|
extraTargets = lib.mapAttrsToList (_: value: value.systemdTargets) sp.email;
|
||||||
in
|
in
|
||||||
lib.mkIf sp.modules.simple-nixos-mailserver.enable (
|
lib.mkIf sp.modules.simple-nixos-mailserver.enable (
|
||||||
lib.mkMerge [
|
lib.mkMerge [
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
{ config, lib, ... }:
|
{ lib, ... }:
|
||||||
{
|
{
|
||||||
options.selfprivacy.modules.simple-nixos-mailserver = {
|
options.selfprivacy.modules.simple-nixos-mailserver = {
|
||||||
enable =
|
enable =
|
||||||
@@ -34,54 +34,4 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
options.sp.email = with lib; mkOption {
|
|
||||||
type = types.attrsOf (
|
|
||||||
types.submodule (
|
|
||||||
{ name, ... }: {
|
|
||||||
options = {
|
|
||||||
subdomain = mkOption {
|
|
||||||
type = with types; strMatching "[A-Za-z0-9][A-Za-z0-9\-]{0,61}[A-Za-z0-9]";
|
|
||||||
example = "myservice";
|
|
||||||
default = config.sp.domain;
|
|
||||||
description = "Email subdomain";
|
|
||||||
};
|
|
||||||
|
|
||||||
systemdTargets = mkOption {
|
|
||||||
type = with types; listOf strMatchig "[a-zA-Z0-9@%:_.\-]+[.](service|socket|device|mount|automount|swap|target|path|timer|scope|slice)";
|
|
||||||
default = [];
|
|
||||||
example = [ "generate-mastodon-email-password.service" ];
|
|
||||||
description = "Systemd target which generates password file.";
|
|
||||||
};
|
|
||||||
|
|
||||||
sendOnly = mkOption {
|
|
||||||
type = with types; bool;
|
|
||||||
default = true;
|
|
||||||
example = "false";
|
|
||||||
description = "Specifies if the account should be a send-only account. Emails sent to send-only accounts will be rejected.";
|
|
||||||
};
|
|
||||||
|
|
||||||
hashedPasswordFile = mkOption {
|
|
||||||
type = with types; str;
|
|
||||||
example = "/run/keys/mastodon/email_password";
|
|
||||||
description = "Path where a file containing password hash located.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
description = ''
|
|
||||||
Don't use this option to create regular users!!!
|
|
||||||
|
|
||||||
This option gives modules possibility to create mailboxes to send emails, e.g. notifications or reminders.
|
|
||||||
'';
|
|
||||||
|
|
||||||
example = {
|
|
||||||
"noreply@mastodon.example.tld" = {
|
|
||||||
hashedPasswordFile = "/run/keys/mastodon/email_password";
|
|
||||||
systemdTargets = [ "generate-mastodon-email-password.service" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user