notmuch and alot

feat/kile-v2
Ricard Illa 2022-04-24 17:28:46 +02:00
parent 2827d2f025
commit 0c3cd27f4d
No known key found for this signature in database
GPG Key ID: F69A672B72E54902
3 changed files with 121 additions and 125 deletions

View File

@ -85,6 +85,7 @@ let
tls.enable = true; tls.enable = true;
port = 993; port = 993;
}; };
notmuch.enable = true;
}; };
switchAccountMacro = i: x: { switchAccountMacro = i: x: {
@ -523,12 +524,10 @@ in {
]; ];
}; };
#programs.notmuch = { programs.notmuch = {
# enable = true; enable = true;
# new = { new = { tags = [ "unread" "inbox" ]; };
# tags = ["unread" "inbox"]; };
# };
#};
programs.mbsync.enable = true; programs.mbsync.enable = true;
programs.msmtp.enable = true; programs.msmtp.enable = true;

View File

@ -20,11 +20,10 @@ let
maildir = "${config.home.homeDirectory}/Maildir"; maildir = "${config.home.homeDirectory}/Maildir";
passwordStoreDir = "${config.home.homeDirectory}/.password-store"; passwordStoreDir = "${config.home.homeDirectory}/.password-store";
notmuchConfig = "${config.home.homeDirectory}/.notmuch-config"; notmuchConfig = "${config.home.homeDirectory}/.config/notmuch/default/config";
gnupghome = "${config.home.homeDirectory}/.gnupg"; gnupghome = "${config.home.homeDirectory}/.gnupg";
lastrun = "${config.home.homeDirectory}/.mailsynclastrun"; lastrun = "${config.home.homeDirectory}/.mailsynclastrun";
in in pkgs.writeScriptBin "mailsync" ''
pkgs.writeScriptBin "mailsync" ''
#!${shell} #!${shell}
# Run only if not already running in other instance # Run only if not already running in other instance
@ -92,13 +91,13 @@ in
${awk} '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | \ ${awk} '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | \
${perl} -CS -MEncode -ne 'print decode("MIME-Header", $_)' | \ ${perl} -CS -MEncode -ne 'print decode("MIME-Header", $_)' | \
${awk} '{ $1=""; if (NF>=3)$NF=""; print $0 }' | \ ${awk} '{ $1=""; if (NF>=3)$NF=""; print $0 }' | \
${sed} 's/^[[:blank:]]*[\"'\''\'''\'\<]*//;s/[\"'\''\'''\'\>]*[[:blank:]]*$//' ${sed} 's/^[[:blank:]]*[\"'\'''\<]*//;s/[\"'\'''\>]*[[:blank:]]*$//'
) )
subject=$( subject=$(
${awk} '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | \ ${awk} '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | \
${head} -n 1 | ${perl} -CS -MEncode -ne 'print decode("MIME-Header", $_)' | \ ${head} -n 1 | ${perl} -CS -MEncode -ne 'print decode("MIME-Header", $_)' | \
${sed} 's/^Subject: //' | \ ${sed} 's/^Subject: //' | \
${sed} 's/^{[[:blank:]]*[\"'\''\'''\'\<]*//;s/[\"'\''\'''\'\>]*[[:blank:]]*$//' | \ ${sed} 's/^{[[:blank:]]*[\"'\'''\<]*//;s/[\"'\'''\>]*[[:blank:]]*$//' | \
${tr} -d '\n' ${tr} -d '\n'
) )
messageinfo "$from" "$subject" & messageinfo "$from" "$subject" &
@ -129,4 +128,4 @@ in
#Create a touch file that indicates the time of the last run of mailsync #Create a touch file that indicates the time of the last run of mailsync
${touch} "${lastrun}" ${touch} "${lastrun}"
'' ''

View File

@ -9,8 +9,6 @@
home.username = "rilla"; home.username = "rilla";
home.homeDirectory = "/home/rilla"; home.homeDirectory = "/home/rilla";
nixpkgs.overlays = [ (self: super: { alot = stablePkgs.alot; }) ];
imports = [ imports = [
./arduino ./arduino
./barrier ./barrier