home: add mail and accounts configuration

This commit is contained in:
Bruno BELANYI 2021-05-22 16:04:46 +02:00
parent 81647c5a02
commit 182ec2a4db
3 changed files with 108 additions and 0 deletions

View file

@ -14,6 +14,7 @@
./gtk.nix ./gtk.nix
./htop.nix ./htop.nix
./jq.nix ./jq.nix
./mail
./mpv.nix ./mpv.nix
./nix-index.nix ./nix-index.nix
./nm-applet.nix ./nm-applet.nix

95
home/mail/accounts.nix Normal file
View file

@ -0,0 +1,95 @@
{ lib, pkgs, ... }:
let
mkAddress = address: domain: "${address}@${domain}";
mkConfig = { domain, address, passName, aliases ? [ ], primary ? false }: {
realName = lib.mkDefault "Bruno BELANYI";
userName = lib.mkDefault (mkAddress address domain);
passwordCommand =
lib.mkDefault [ "${pkgs.ambroisie.bw-pass}/bin/bw-pass" "Mail" passName ];
address = mkAddress address domain;
aliases = builtins.map (lib.flip mkAddress domain) aliases;
inherit primary;
};
migaduConfig = {
imap = {
host = "imap.migadu.com";
port = 993;
tls = {
enable = true;
};
};
smtp = {
host = "smtp.migadu.com";
port = 465;
tls = {
enable = true;
};
};
};
gmailConfig = {
flavor = "gmail.com";
folders = {
drafts = "[Gmail]/Drafts";
sent = "[Gmail]/Sent Mail";
trash = "[Gmail]/Trash";
};
};
office365Config = {
imap = {
host = "outlook.office365.com";
port = 993;
tls = {
enable = true;
};
};
smtp = {
host = "outlook.office365.com";
port = 587;
tls = {
enable = true;
useStartTls = true;
};
};
};
in
{
config.accounts.email.accounts = {
personal = lib.mkMerge [
# Common configuraton
(mkConfig {
domain = "belanyi.fr";
address = "bruno";
passName = "Migadu";
aliases = [ "admin" "postmaster" ];
primary = true; # This is my primary email
})
migaduConfig
];
gmail = lib.mkMerge [
# Common configuraton
(mkConfig {
domain = "gmail.com";
address = "brunobelanyi";
passName = "GMail";
})
gmailConfig
];
epita = lib.mkMerge [
# Common configuration
(mkConfig {
domain = "epita.fr";
address = "bruno.belanyi";
passName = "EPITA";
})
office365Config
];
};
}

12
home/mail/default.nix Normal file
View file

@ -0,0 +1,12 @@
{ config, lib, ... }:
{
imports = [
./accounts.nix
];
config = {
accounts.email = {
maildirBasePath = "mail";
};
};
}