From d8e0210c3018206761c545b7f7179d7eed890374 Mon Sep 17 00:00:00 2001 From: kiana-S Date: Tue, 13 Feb 2024 15:13:46 -0500 Subject: [PATCH] Configure email client --- flake.nix | 4 +++- home-manager/default.nix | 6 +++--- home-manager/email.nix | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 home-manager/email.nix diff --git a/flake.nix b/flake.nix index 884b5bb..87a9d7f 100644 --- a/flake.nix +++ b/flake.nix @@ -26,7 +26,9 @@ outputs = { self, let username = "kiana"; fullname = "Kiana Sheibani"; - moduleArgs = { inherit username fullname; } // inputs; + email = "kiana.a.sheibani@gmail.com"; + + moduleArgs = { inherit username fullname email; } // inputs; lib = nixpkgs.lib; in { nixosConfigurations = { diff --git a/home-manager/default.nix b/home-manager/default.nix index 326609f..abeb84c 100644 --- a/home-manager/default.nix +++ b/home-manager/default.nix @@ -1,11 +1,11 @@ -{ config, pkgs, username, fullname, ... }: +{ config, pkgs, username, fullname, email, ... }: { home.username = username; home.homeDirectory = "/home/" + username; home.stateVersion = "21.11"; - imports = [ ./shell ./wayland ]; + imports = [ ./shell ./wayland ./email.nix ]; xdg.enable = true; xdg.userDirs.enable = true; @@ -13,7 +13,7 @@ programs.git = { enable = true; userName = fullname; - userEmail = "kiana.a.sheibani@gmail.com"; + userEmail = email; signing.key = "6CB106C25E86A9F7"; signing.signByDefault = true; diff --git a/home-manager/email.nix b/home-manager/email.nix new file mode 100644 index 0000000..e0c8f65 --- /dev/null +++ b/home-manager/email.nix @@ -0,0 +1,37 @@ +{ pkgs, fullname, email, ... }: +let + maildir = "/home/kiana/.mail"; +in { + accounts.email = { + maildirBasePath = maildir; + accounts = { + Gmail = { + address = email; + userName = email; + flavor = "gmail.com"; + primary = true; + mbsync = { + enable = true; + create = "both"; + expunge = "both"; + patterns = [ "*" ]; + }; + realName = fullname; + msmtp.enable = true; + }; + }; + }; + + programs = { + msmtp.enable = true; + mbsync.enable = true; + }; + + services = { + mbsync = { + enable = true; + preExec = "${pkgs.isync}/bin/mbsync -Ha"; + postExec = "${pkgs.mu}/bin/mu index -m ${maildir}"; + }; + }; +}