Services: modularize msmtp
This commit is contained in:
parent
38066e07da
commit
368af96a92
12
flake.lock
12
flake.lock
|
@ -281,11 +281,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs-unstable": {
|
"nixpkgs-unstable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1726062873,
|
"lastModified": 1726243404,
|
||||||
"narHash": "sha256-IiA3jfbR7K/B5+9byVi9BZGWTD4VSbWe8VLpp9B/iYk=",
|
"narHash": "sha256-sjiGsMh+1cWXb53Tecsm4skyFNag33GPbVgCdfj3n9I=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "4f807e8940284ad7925ebd0a0993d2a1791acb2f",
|
"rev": "345c263f2f53a3710abe117f28a5cb86d0ba4059",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -297,11 +297,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1726062281,
|
"lastModified": 1726320982,
|
||||||
"narHash": "sha256-PyFVySdGj3enKqm8RQuo4v1KLJLmNLOq2yYOHsI6e2Q=",
|
"narHash": "sha256-RuVXUwcYwaUeks6h3OLrEmg14z9aFXdWppTWPMTwdQw=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "e65aa8301ba4f0ab8cb98f944c14aa9da07394f8",
|
"rev": "8f7492cce28977fbf8bd12c72af08b1f6c7c3e49",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -154,7 +154,25 @@ in
|
||||||
home = "${services-root}/jellyfin";
|
home = "${services-root}/jellyfin";
|
||||||
url = config.secrets.services.jellyfin.url;
|
url = config.secrets.services.jellyfin.url;
|
||||||
};
|
};
|
||||||
msmtp.enable = true;
|
msmtp = {
|
||||||
|
enable = true;
|
||||||
|
accounts.default = {
|
||||||
|
host = config.secrets.services.msmtp.host;
|
||||||
|
user = config.secrets.services.msmtp.user;
|
||||||
|
password = config.secrets.services.msmtp.password;
|
||||||
|
auth = true;
|
||||||
|
tls = true;
|
||||||
|
tls_starttls = true;
|
||||||
|
port = 587;
|
||||||
|
from = "${config.networking.hostName}@${config.secrets.networking.domains.primary}";
|
||||||
|
};
|
||||||
|
aliases = {
|
||||||
|
text = ''
|
||||||
|
default: ${config.secrets.users.aires.email}
|
||||||
|
'';
|
||||||
|
mode = "0644";
|
||||||
|
};
|
||||||
|
};
|
||||||
netdata = {
|
netdata = {
|
||||||
enable = true;
|
enable = true;
|
||||||
type = "parent";
|
type = "parent";
|
||||||
|
|
|
@ -6,31 +6,28 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
aux.system.services.msmtp.enable = lib.mkEnableOption "Enables mail server";
|
aux.system.services.msmtp = {
|
||||||
|
enable = lib.mkEnableOption "Enables mail server";
|
||||||
|
accounts = lib.mkOption {
|
||||||
|
type = lib.types.attrs;
|
||||||
|
description = "A list of accounts to use for msmtp.";
|
||||||
|
};
|
||||||
|
aliases = lib.mkOption {
|
||||||
|
default = {};
|
||||||
|
type = lib.types.attrs;
|
||||||
|
description = "Optional email aliases to add.";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
programs.msmtp = {
|
programs.msmtp = {
|
||||||
enable = true;
|
enable = true;
|
||||||
defaults.aliases = "/etc/aliases";
|
defaults.aliases = "/etc/aliases";
|
||||||
accounts.default = {
|
accounts = cfg.accounts;
|
||||||
host = config.secrets.services.msmtp.host;
|
|
||||||
user = config.secrets.services.msmtp.user;
|
|
||||||
password = config.secrets.services.msmtp.password;
|
|
||||||
auth = true;
|
|
||||||
tls = true;
|
|
||||||
tls_starttls = true;
|
|
||||||
port = 587;
|
|
||||||
from = "${config.networking.hostName}@${config.secrets.networking.domains.primary}";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Send all mail to my email address by default
|
# Send all mail to my email address by default
|
||||||
environment.etc."aliases" = {
|
environment.etc."aliases" = cfg.aliases;
|
||||||
text = ''
|
|
||||||
default: ${config.secrets.users.aires.email}
|
|
||||||
'';
|
|
||||||
mode = "0644";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue