Rework mail options

This commit is contained in:
Victor Mignot 2025-01-03 13:36:02 +01:00
parent cf5586abd0
commit 6b5591b478
Signed by: dala
SSH key fingerprint: SHA256:+3O9MhlDc2tJL0n+E+Myr7nL+74DP9AXdIXHmIqZTkY
7 changed files with 92 additions and 26 deletions

View file

@ -22,6 +22,17 @@
age.secrets = {
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
@ -86,6 +97,11 @@
my.games.wine.enable = true;
my.games.steam.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}";
};
};
};

View file

@ -79,11 +79,11 @@
},
"extra-config": {
"locked": {
"lastModified": 1733857702,
"narHash": "sha256-Bo8w+Pi7tS5z3yAuaTkW9+Eh7+0YiSV+HuCAf2m2w1I=",
"lastModified": 1735909779,
"narHash": "sha256-Io0thwq2X2M5jiw9SQO+VAbxS+hP6OJqxgI/qi2LkrI=",
"ref": "refs/heads/main",
"rev": "f6fed9c40dbea65d6aa80b53fc3c1be62c1d8ac2",
"revCount": 9,
"rev": "aa3e249bbc51649702359af9ea6e8dc9f5ac4e66",
"revCount": 11,
"type": "git",
"url": "ssh://forgejo@git.dalaran.fr/dala/nixos-config-extra.git"
},
@ -248,11 +248,11 @@
]
},
"locked": {
"lastModified": 1735774425,
"narHash": "sha256-C73gLFnEh8ZI0uDijUgCDWCd21T6I6tsaWgIBHcfAXg=",
"lastModified": 1735900408,
"narHash": "sha256-U+oZBQ3f5fF2hHsupKQH4ihgTKLHgcJh6jEmKDg+W10=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "5f6aa268e419d053c3d5025da740e390b12ac936",
"rev": "1c8d4c8d592e8fab4cff4397db5529ec6f078cf9",
"type": "github"
},
"original": {

View file

@ -2,6 +2,7 @@
config,
pkgs,
machineProps,
extraInfo,
...
}:
{
@ -34,6 +35,7 @@
home-manager.extraSpecialArgs = {
keymap = config.console.keyMap;
isNvidiaGpu = (config.my.hardware.gpu == "nvidia");
inherit extraInfo;
};
home-manager.users = builtins.mapAttrs (name: value: {
imports = [ value.hmConfig ];

View file

@ -1,12 +1,14 @@
# TODO: Clean this mess
{
lib,
pkgs,
config,
extraInfo,
...
}:
with lib;
let
mailAccountModule = types.submodule {
options = {
isPrimary = mkOption {
type = types.bool;
default = false;
@ -20,10 +22,10 @@ let
smtpHost = mkOption { type = types.str; };
};
};
defaultExtraMailboxes = [
"Archive"
"Receipts"
"Junk"
"Drafts"
"Sent"
@ -37,15 +39,36 @@ let
showSignature = "append";
};
hasNoAddress = config.my.communications.mail.accounts == null;
in
{
options.my.communications.mail.accounts = mkOption {
type = types.nullOr (types.attrsOf mailAccountModule);
default = null;
mailDefaults = {
"perso" = {
isPrimary = true;
mailAddress = extraInfo.mail.personal.address;
mailPasswdEval = mkDefault "";
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: {
primary = value.isPrimary;
@ -53,7 +76,7 @@ in
userName = value.mailAddress;
realName = "Victor Mignot";
imap.host = value.imapHost;
smtpHost = value.smtpHost;
smtp.host = value.smtpHost;
passwordCommand = value.mailPasswdEval;
inherit signature;
@ -79,6 +102,7 @@ in
services.mbsync.enable = true;
programs.mbsync.enable = true;
programs.msmtp.enable = true;
accounts.email.maildirBasePath = "Mail";
programs.neomutt = {

View 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
View 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褈¸ â•Sx²ã¦žB½``Ùõb?×Â<C397>A>Ófíxnç

View file

@ -36,4 +36,14 @@ in
"fuyuki-wg0.age".publicKeys = [
fuyuki
];
"personal-mail.age".publicKeys = [
fuyuki
london
];
"public-mail.age".publicKeys = [
fuyuki
london
];
}