Rework mail options
This commit is contained in:
parent
cf5586abd0
commit
6b5591b478
7 changed files with 92 additions and 26 deletions
|
@ -22,6 +22,17 @@
|
||||||
|
|
||||||
age.secrets = {
|
age.secrets = {
|
||||||
wg0Private.file = ../../secrets/london-wg0.age;
|
wg0Private.file = ../../secrets/london-wg0.age;
|
||||||
|
personalMailPwd = {
|
||||||
|
file = ../../secrets/personal-mail.age;
|
||||||
|
owner = config.users.users.dala.name;
|
||||||
|
group = config.users.users.dala.group;
|
||||||
|
};
|
||||||
|
|
||||||
|
publicMailPwd = {
|
||||||
|
file = ../../secrets/public-mail.age;
|
||||||
|
owner = config.users.users.dala.name;
|
||||||
|
group = config.users.users.dala.group;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Wireguard
|
# Wireguard
|
||||||
|
@ -86,6 +97,11 @@
|
||||||
my.games.wine.enable = true;
|
my.games.wine.enable = true;
|
||||||
my.games.steam.enable = true;
|
my.games.steam.enable = true;
|
||||||
my.games.minecraft.enable = true;
|
my.games.minecraft.enable = true;
|
||||||
|
|
||||||
|
my.communications.mail.accounts."perso".mailPasswdEval =
|
||||||
|
"${pkgs.coreutils}/bin/cat ${config.age.secrets.personalMailPwd.path}";
|
||||||
|
my.communications.mail.accounts."public".mailPasswdEval =
|
||||||
|
"${pkgs.coreutils}/bin/cat ${config.age.secrets.publicMailPwd.path}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
14
flake.lock
14
flake.lock
|
@ -79,11 +79,11 @@
|
||||||
},
|
},
|
||||||
"extra-config": {
|
"extra-config": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1733857702,
|
"lastModified": 1735909779,
|
||||||
"narHash": "sha256-Bo8w+Pi7tS5z3yAuaTkW9+Eh7+0YiSV+HuCAf2m2w1I=",
|
"narHash": "sha256-Io0thwq2X2M5jiw9SQO+VAbxS+hP6OJqxgI/qi2LkrI=",
|
||||||
"ref": "refs/heads/main",
|
"ref": "refs/heads/main",
|
||||||
"rev": "f6fed9c40dbea65d6aa80b53fc3c1be62c1d8ac2",
|
"rev": "aa3e249bbc51649702359af9ea6e8dc9f5ac4e66",
|
||||||
"revCount": 9,
|
"revCount": 11,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "ssh://forgejo@git.dalaran.fr/dala/nixos-config-extra.git"
|
"url": "ssh://forgejo@git.dalaran.fr/dala/nixos-config-extra.git"
|
||||||
},
|
},
|
||||||
|
@ -248,11 +248,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1735774425,
|
"lastModified": 1735900408,
|
||||||
"narHash": "sha256-C73gLFnEh8ZI0uDijUgCDWCd21T6I6tsaWgIBHcfAXg=",
|
"narHash": "sha256-U+oZBQ3f5fF2hHsupKQH4ihgTKLHgcJh6jEmKDg+W10=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "5f6aa268e419d053c3d5025da740e390b12ac936",
|
"rev": "1c8d4c8d592e8fab4cff4397db5529ec6f078cf9",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
machineProps,
|
machineProps,
|
||||||
|
extraInfo,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
|
@ -34,6 +35,7 @@
|
||||||
home-manager.extraSpecialArgs = {
|
home-manager.extraSpecialArgs = {
|
||||||
keymap = config.console.keyMap;
|
keymap = config.console.keyMap;
|
||||||
isNvidiaGpu = (config.my.hardware.gpu == "nvidia");
|
isNvidiaGpu = (config.my.hardware.gpu == "nvidia");
|
||||||
|
inherit extraInfo;
|
||||||
};
|
};
|
||||||
home-manager.users = builtins.mapAttrs (name: value: {
|
home-manager.users = builtins.mapAttrs (name: value: {
|
||||||
imports = [ value.hmConfig ];
|
imports = [ value.hmConfig ];
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
|
# TODO: Clean this mess
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
|
||||||
config,
|
config,
|
||||||
|
extraInfo,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
mailAccountModule = types.submodule {
|
mailAccountModule = types.submodule {
|
||||||
|
options = {
|
||||||
isPrimary = mkOption {
|
isPrimary = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
@ -20,10 +22,10 @@ let
|
||||||
|
|
||||||
smtpHost = mkOption { type = types.str; };
|
smtpHost = mkOption { type = types.str; };
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
defaultExtraMailboxes = [
|
defaultExtraMailboxes = [
|
||||||
"Archive"
|
"Archive"
|
||||||
"Receipts"
|
|
||||||
"Junk"
|
"Junk"
|
||||||
"Drafts"
|
"Drafts"
|
||||||
"Sent"
|
"Sent"
|
||||||
|
@ -37,15 +39,36 @@ let
|
||||||
showSignature = "append";
|
showSignature = "append";
|
||||||
};
|
};
|
||||||
|
|
||||||
hasNoAddress = config.my.communications.mail.accounts == null;
|
mailDefaults = {
|
||||||
in
|
"perso" = {
|
||||||
{
|
isPrimary = true;
|
||||||
options.my.communications.mail.accounts = mkOption {
|
mailAddress = extraInfo.mail.personal.address;
|
||||||
type = types.nullOr (types.attrsOf mailAccountModule);
|
mailPasswdEval = mkDefault "";
|
||||||
default = null;
|
imapHost = extraInfo.mail.personal.imapServer;
|
||||||
|
smtpHost = extraInfo.mail.personal.smtpServer;
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf (!hasNoAddress) {
|
"public" = {
|
||||||
|
mailAddress = extraInfo.mail.public.address;
|
||||||
|
mailPasswdEval = mkDefault "";
|
||||||
|
imapHost = extraInfo.mail.public.imapServer;
|
||||||
|
smtpHost = extraInfo.mail.public.smtpServer;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.my.communications.mail = {
|
||||||
|
enable = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
|
accounts = mkOption {
|
||||||
|
type = types.attrsOf mailAccountModule;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf config.my.communications.mail.enable {
|
||||||
|
my.communications.mail.accounts = mailDefaults;
|
||||||
|
|
||||||
accounts.email.accounts = builtins.mapAttrs (name: value: {
|
accounts.email.accounts = builtins.mapAttrs (name: value: {
|
||||||
primary = value.isPrimary;
|
primary = value.isPrimary;
|
||||||
|
@ -53,7 +76,7 @@ in
|
||||||
userName = value.mailAddress;
|
userName = value.mailAddress;
|
||||||
realName = "Victor Mignot";
|
realName = "Victor Mignot";
|
||||||
imap.host = value.imapHost;
|
imap.host = value.imapHost;
|
||||||
smtpHost = value.smtpHost;
|
smtp.host = value.smtpHost;
|
||||||
passwordCommand = value.mailPasswdEval;
|
passwordCommand = value.mailPasswdEval;
|
||||||
inherit signature;
|
inherit signature;
|
||||||
|
|
||||||
|
@ -79,6 +102,7 @@ in
|
||||||
|
|
||||||
services.mbsync.enable = true;
|
services.mbsync.enable = true;
|
||||||
programs.mbsync.enable = true;
|
programs.mbsync.enable = true;
|
||||||
|
programs.msmtp.enable = true;
|
||||||
|
|
||||||
accounts.email.maildirBasePath = "Mail";
|
accounts.email.maildirBasePath = "Mail";
|
||||||
programs.neomutt = {
|
programs.neomutt = {
|
||||||
|
|
7
secrets/personal-mail.age
Normal file
7
secrets/personal-mail.age
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
age-encryption.org/v1
|
||||||
|
-> ssh-ed25519 BEMung +aBin3xqwalIg1d3rxbAesYks5jlrwrpqrKfyQsXplU
|
||||||
|
FLwL99xJ+efX7Q6gt9vbGlkBcOgP6t2V/xkqtMH0dPg
|
||||||
|
-> ssh-ed25519 bPPSlQ 1gpo0QvVqWfGapVUwrGeRUHtLNDf12FCx2YQRPRBVgY
|
||||||
|
Ax8o5+od6TmojfriKuagfGhUgF4UQyAlfZ3JvDTiTE8
|
||||||
|
--- 9YLjJw5AnKJW6PCWHn2F0jTAvhliCLDw7ffGFV/YWbI
|
||||||
|
L±J¨Wúeôä‹ÒIº+©þÑ׳Ÿz¿T·’”ü9Ã"¹AŶ°f%¨W
|
7
secrets/public-mail.age
Normal file
7
secrets/public-mail.age
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
age-encryption.org/v1
|
||||||
|
-> ssh-ed25519 BEMung EcJ8HDcEVy2WdgKMhSuFW6okzJ5m74T26miewHXnj00
|
||||||
|
p2Hb13hUk+at6iIf1c7Vm1iNkkbs+qzOs1LggzQtLmA
|
||||||
|
-> ssh-ed25519 bPPSlQ PT/oPiIunDRDiruu2A2/0eySlEbsn0je/Uz/dDhRRiE
|
||||||
|
+9KeZBkxN96RLBa6JFYk3WGP0rccIqyfrjc+h0ElGyQ
|
||||||
|
--- m20hcHpeetuYPQxJJwNpOORbADECSHP/ropZV56VpIw
|
||||||
|
òYQüyˆÌ¾éE褒q â•Sx²ã¦žB½``Ùõb?×Â<C397>A>Ófíxnç
|
|
@ -36,4 +36,14 @@ in
|
||||||
"fuyuki-wg0.age".publicKeys = [
|
"fuyuki-wg0.age".publicKeys = [
|
||||||
fuyuki
|
fuyuki
|
||||||
];
|
];
|
||||||
|
|
||||||
|
"personal-mail.age".publicKeys = [
|
||||||
|
fuyuki
|
||||||
|
london
|
||||||
|
];
|
||||||
|
|
||||||
|
"public-mail.age".publicKeys = [
|
||||||
|
fuyuki
|
||||||
|
london
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue