mbsync + msmtp + mu setup via home-manager
Initial setup to email from within emacs. That required setting up above stuff, detailed below: mbsync : sync maildir with email host/provider (gmail) mu : index and search maildir msmtp : send mail All of the above have good module under home-manager, making it *relatively* straightforward to set the whole thing up.
This commit is contained in:
parent
51654e5e8d
commit
4cffebb34c
3 changed files with 100 additions and 6 deletions
27
flake.lock
27
flake.lock
|
@ -1,12 +1,32 @@
|
|||
{
|
||||
"nodes": {
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1626743774,
|
||||
"narHash": "sha256-ah5l6UK+VgVoztzD/GXFBYU65DeAgGLOZYZKVe47oDY=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "fa483b82ab35c670de12a022d7c57237c3b31008",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1626464457,
|
||||
"narHash": "sha256-u2PCh/+8vQSLwf0mPpKHKQ8hAPB3l4uNZR3r0TdK2Lg=",
|
||||
"lastModified": 1626556499,
|
||||
"narHash": "sha256-c2ueMT7fi/yvCNq3nGLEC2v5GklS7eHpB1240LRSW9Y=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c6c4a3d45ab200f17805d2d86a1ff1cc7ca2b186",
|
||||
"rev": "b59c06dc92f8d03660eb4155754d93a6c34cda83",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -18,6 +38,7 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"home-manager": "home-manager",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
|
|
20
flake.nix
20
flake.nix
|
@ -1,13 +1,27 @@
|
|||
{
|
||||
description = "Payas' NixOS configuration (flake edition)";
|
||||
|
||||
inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; };
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, ... }: {
|
||||
outputs = { self, nixpkgs, home-manager, ... }: {
|
||||
nixosConfigurations = {
|
||||
enterprise = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [ (import ./hosts/enterprise/configuration.nix) ];
|
||||
modules = [
|
||||
(import ./hosts/enterprise/configuration.nix)
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.payas = import ./hosts/enterprise/home.nix;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
59
hosts/enterprise/home.nix
Normal file
59
hosts/enterprise/home.nix
Normal file
|
@ -0,0 +1,59 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
# https://raw.githubusercontent.com/Emiller88/dotfiles/5eaabedf1b141c80a8d32e1b496055231476f65e/modules/shell/mail.nix
|
||||
|
||||
with lib;
|
||||
let
|
||||
name = "Payas Relekar";
|
||||
maildir = "/home/payas/.mail";
|
||||
email = "relekarpayas@gmail.com";
|
||||
in {
|
||||
accounts.email = {
|
||||
maildirBasePath = "${maildir}";
|
||||
accounts = {
|
||||
Gmail = {
|
||||
address = "${email}";
|
||||
userName = "${email}";
|
||||
flavor = "gmail.com";
|
||||
passwordCommand =
|
||||
"keepassxc-cli show -sa password ~/Keepass/kpdb2.kdbx Apps/mu4e";
|
||||
primary = true;
|
||||
# gpg.encryptByDefault = true;
|
||||
mbsync = {
|
||||
enable = true;
|
||||
create = "both";
|
||||
expunge = "both";
|
||||
patterns = [ "*" "[Gmail]*" ]; # "[Gmail]/Sent Mail" ];
|
||||
};
|
||||
imap = {
|
||||
host = "imap.gmail.com";
|
||||
port = 993;
|
||||
tls.enable = true;
|
||||
};
|
||||
realName = "${name}";
|
||||
msmtp.enable = true;
|
||||
mu.enable = true;
|
||||
smtp = {
|
||||
host = "smtp.gmail.com";
|
||||
port = 587;
|
||||
tls.useStartTls = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
programs = {
|
||||
msmtp.enable = true;
|
||||
mbsync.enable = true;
|
||||
mu.enable = true;
|
||||
};
|
||||
|
||||
services = {
|
||||
mbsync = {
|
||||
enable = true;
|
||||
frequency = "*:0/15";
|
||||
preExec = "${pkgs.isync}/bin/mbsync -Ha";
|
||||
postExec = "${pkgs.mu}/bin/mu index -m ${maildir}";
|
||||
};
|
||||
};
|
||||
}
|
Reference in a new issue