diff --git a/configurations/london/default.nix b/configurations/london/default.nix index 63539a9..8251069 100644 --- a/configurations/london/default.nix +++ b/configurations/london/default.nix @@ -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}"; }; }; }; diff --git a/flake.lock b/flake.lock index 17549d6..c2f70ec 100644 --- a/flake.lock +++ b/flake.lock @@ -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": { diff --git a/modules/workstation/default.nix b/modules/workstation/default.nix index 76b9676..052af9b 100644 --- a/modules/workstation/default.nix +++ b/modules/workstation/default.nix @@ -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 ]; diff --git a/modules/workstation/home-manager/mail.nix b/modules/workstation/home-manager/mail.nix index 4906173..3f2f905 100644 --- a/modules/workstation/home-manager/mail.nix +++ b/modules/workstation/home-manager/mail.nix @@ -1,29 +1,31 @@ +# TODO: Clean this mess { lib, - pkgs, config, + extraInfo, ... }: with lib; let mailAccountModule = types.submodule { - isPrimary = mkOption { - type = types.bool; - default = false; + options = { + isPrimary = mkOption { + type = types.bool; + default = false; + }; + + mailAddress = mkOption { type = types.str; }; + + mailPasswdEval = mkOption { type = types.str; }; + + imapHost = mkOption { type = types.str; }; + + smtpHost = mkOption { type = types.str; }; }; - - mailAddress = mkOption { type = types.str; }; - - mailPasswdEval = mkOption { type = types.str; }; - - imapHost = mkOption { type = types.str; }; - - 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; + mailDefaults = { + "perso" = { + isPrimary = true; + mailAddress = extraInfo.mail.personal.address; + mailPasswdEval = mkDefault ""; + imapHost = extraInfo.mail.personal.imapServer; + smtpHost = extraInfo.mail.personal.smtpServer; + }; + + "public" = { + mailAddress = extraInfo.mail.public.address; + mailPasswdEval = mkDefault ""; + imapHost = extraInfo.mail.public.imapServer; + smtpHost = extraInfo.mail.public.smtpServer; + }; + }; in { - options.my.communications.mail.accounts = mkOption { - type = types.nullOr (types.attrsOf mailAccountModule); - default = null; + options.my.communications.mail = { + enable = mkOption { + type = types.bool; + default = true; + }; + accounts = mkOption { + type = types.attrsOf mailAccountModule; + }; }; - config = mkIf (!hasNoAddress) { + 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 = { diff --git a/secrets/personal-mail.age b/secrets/personal-mail.age new file mode 100644 index 0000000..6e52f5e --- /dev/null +++ b/secrets/personal-mail.age @@ -0,0 +1,7 @@ +age-encryption.org/v1 +-> ssh-ed25519 BEMung +aBin3xqwalIg1d3rxbAesYks5jlrwrpqrKfyQsXplU +FLwL99xJ+efX7Q6gt9vbGlkBcOgP6t2V/xkqtMH0dPg +-> ssh-ed25519 bPPSlQ 1gpo0QvVqWfGapVUwrGeRUHtLNDf12FCx2YQRPRBVgY +Ax8o5+od6TmojfriKuagfGhUgF4UQyAlfZ3JvDTiTE8 +--- 9YLjJw5AnKJW6PCWHn2F0jTAvhliCLDw7ffGFV/YWbI +LJWeI+׳zT9"AŶf%W \ No newline at end of file diff --git a/secrets/public-mail.age b/secrets/public-mail.age new file mode 100644 index 0000000..758fcbf --- /dev/null +++ b/secrets/public-mail.age @@ -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 +YQyE褒q SxB``b?A>fxn \ No newline at end of file diff --git a/secrets/secrets.nix b/secrets/secrets.nix index 5508188..9304219 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -36,4 +36,14 @@ in "fuyuki-wg0.age".publicKeys = [ fuyuki ]; + + "personal-mail.age".publicKeys = [ + fuyuki + london + ]; + + "public-mail.age".publicKeys = [ + fuyuki + london + ]; }