style: use alejandra formatter on all nix files
This commit is contained in:
parent
d563805909
commit
0d8a394dcf
76 changed files with 1287 additions and 935 deletions
|
@ -1,10 +1,14 @@
|
|||
{ lib, config, pkgs, inputs, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.modules.email;
|
||||
secretsDirectory = "${(builtins.toString inputs.nix-private)}/secrets";
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.modules.email = {
|
||||
enable = mkEnableOption "Enable email accounts configuration";
|
||||
|
||||
|
@ -23,11 +27,14 @@ in
|
|||
|
||||
config = mkIf cfg.enable {
|
||||
sops = let
|
||||
secretList = lib.mapAttrs' ( name: value:
|
||||
nameValuePair ( value.secret.key ) ({
|
||||
sopsFile = "${secretsDirectory}/${value.secret.file}";
|
||||
})
|
||||
) cfg.accountConfigs;
|
||||
secretList =
|
||||
lib.mapAttrs' (
|
||||
name: value:
|
||||
nameValuePair (value.secret.key) {
|
||||
sopsFile = "${secretsDirectory}/${value.secret.file}";
|
||||
}
|
||||
)
|
||||
cfg.accountConfigs;
|
||||
in {
|
||||
secrets = secretList;
|
||||
};
|
||||
|
@ -55,28 +62,32 @@ in
|
|||
showDefaultMailbox = false;
|
||||
};
|
||||
};
|
||||
accountsList = lib.mapAttrs ( name: value: lib.recursiveUpdate defaultSetting value.config ) cfg.accountConfigs;
|
||||
accountsList = lib.mapAttrs (name: value: lib.recursiveUpdate defaultSetting value.config) cfg.accountConfigs;
|
||||
in {
|
||||
maildirBasePath = "mail";
|
||||
accounts = lib.recursiveUpdate accountsList { "${cfg.primary}".primary = true; };
|
||||
accounts = lib.recursiveUpdate accountsList {"${cfg.primary}".primary = true;};
|
||||
};
|
||||
|
||||
programs.afew = let
|
||||
mailMoverRules = lib.mergeAttrsList (
|
||||
lib.attrsets.mapAttrsToList (
|
||||
n: v:
|
||||
if lib.hasAttrByPath ["afew" "mailMover"] v then
|
||||
v.afew.mailMover
|
||||
else {}
|
||||
) cfg.accountConfigs);
|
||||
if lib.hasAttrByPath ["afew" "mailMover"] v
|
||||
then v.afew.mailMover
|
||||
else {}
|
||||
)
|
||||
cfg.accountConfigs
|
||||
);
|
||||
mailFilterRules = lib.flatten (
|
||||
lib.attrsets.mapAttrsToList (
|
||||
n: v:
|
||||
if lib.hasAttrByPath ["afew" "filters"] v then
|
||||
v.afew.filters
|
||||
else []
|
||||
) cfg.accountConfigs);
|
||||
in {
|
||||
if lib.hasAttrByPath ["afew" "filters"] v
|
||||
then v.afew.filters
|
||||
else []
|
||||
)
|
||||
cfg.accountConfigs
|
||||
);
|
||||
in {
|
||||
enable = true;
|
||||
extraConfig = ''
|
||||
[FolderNameFilter]
|
||||
|
@ -96,16 +107,20 @@ in
|
|||
'';
|
||||
};
|
||||
programs.neomutt = let
|
||||
accountMacros = lib.imap1 (
|
||||
i:
|
||||
elem: elem // {
|
||||
map = ["index" "pager"];
|
||||
key = "<F${(toString (i + 1))}>";
|
||||
}) (
|
||||
accountMacros =
|
||||
lib.imap1 (
|
||||
i: elem:
|
||||
elem
|
||||
// {
|
||||
map = ["index" "pager"];
|
||||
key = "<F${(toString (i + 1))}>";
|
||||
}
|
||||
) (
|
||||
lib.attrsets.mapAttrsToList (
|
||||
n: c:
|
||||
{ "action" = "<sync-mailbox><refresh><enter-command>source ~/.config/neomutt/${n}<enter><change-vfolder>Unread:${c.config.address}<enter>";}
|
||||
) cfg.accountConfigs);
|
||||
n: c: {"action" = "<sync-mailbox><refresh><enter-command>source ~/.config/neomutt/${n}<enter><change-vfolder>Unread:${c.config.address}<enter>";}
|
||||
)
|
||||
cfg.accountConfigs
|
||||
);
|
||||
in {
|
||||
enable = true;
|
||||
unmailboxes = true;
|
||||
|
@ -136,94 +151,224 @@ in
|
|||
envelope_from = "yes";
|
||||
use_envelope_from = "no";
|
||||
my_status = "' %o/%m | %l | %f %* Sort: %s-%S Pos: %P '";
|
||||
my_pager = "' %F | %s %* Pos: %P '";
|
||||
my_pager = "' %F | %s %* Pos: %P '";
|
||||
compose_format = "' COMPOSE %a | %l'";
|
||||
query_command = "'${pkgs.khard}/bin/khard email --parsable --search-in-source-files %s'";
|
||||
virtual_spoolfile = "yes";
|
||||
mail_check_stats = "yes";
|
||||
mh_purge = "yes";
|
||||
mailcap_path= "${config.xdg.configHome}/neomutt/mailcap";
|
||||
mailcap_path = "${config.xdg.configHome}/neomutt/mailcap";
|
||||
};
|
||||
extraConfig = ''
|
||||
${(builtins.readFile ./files/theme.muttrc)}
|
||||
set reverse_name
|
||||
charset-hook ^iso-8859-1$ cp1252
|
||||
ignore *
|
||||
${(builtins.readFile ./files/theme.muttrc)}
|
||||
set reverse_name
|
||||
charset-hook ^iso-8859-1$ cp1252
|
||||
ignore *
|
||||
|
||||
unignore from date subject to cc bcc tags user-agent x-mailer
|
||||
unignore from date subject to cc bcc tags user-agent x-mailer
|
||||
|
||||
# Attachment
|
||||
auto_view text/x-vcard text/html text/enriched text/calendar
|
||||
alternative_order text/html text/enriched text/plain text/*
|
||||
# Attachment
|
||||
auto_view text/x-vcard text/html text/enriched text/calendar
|
||||
alternative_order text/html text/enriched text/plain text/*
|
||||
|
||||
tag-transforms "attachment" "" \
|
||||
"encrypted" "" \
|
||||
"signed" "" \
|
||||
"unread" "" \
|
||||
"replied" ""
|
||||
tag-formats "attachment" "GA" \
|
||||
"encrypted" "GE" \
|
||||
"signed" "GS" \
|
||||
"unread" "GU" \
|
||||
"replied" "GR"
|
||||
tag-transforms "attachment" "" \
|
||||
"encrypted" "" \
|
||||
"signed" "" \
|
||||
"unread" "" \
|
||||
"replied" ""
|
||||
tag-formats "attachment" "GA" \
|
||||
"encrypted" "GE" \
|
||||
"signed" "GS" \
|
||||
"unread" "GU" \
|
||||
"replied" "GR"
|
||||
|
||||
${lib.concatStrings (lib.attrsets.mapAttrsToList ( _: v: if lib.hasAttrByPath [ "neomuttHooks" ] v then v.neomuttHooks else "" ) cfg.accountConfigs)}
|
||||
# manually source first account instead of use home-manager parameter because
|
||||
# of $my_pager expansion does not work as this variable is not already set
|
||||
source ${config.xdg.configHome}/neomutt/${cfg.primary}
|
||||
${lib.concatStrings (lib.attrsets.mapAttrsToList (_: v:
|
||||
if lib.hasAttrByPath ["neomuttHooks"] v
|
||||
then v.neomuttHooks
|
||||
else "")
|
||||
cfg.accountConfigs)}
|
||||
# manually source first account instead of use home-manager parameter because
|
||||
# of $my_pager expansion does not work as this variable is not already set
|
||||
source ${config.xdg.configHome}/neomutt/${cfg.primary}
|
||||
'';
|
||||
binds = [
|
||||
{ map = [ "attach" "browser" "index" "pager" ]; key = "g"; action = "noop"; }
|
||||
{ map = [ "attach" "browser" "index" "pager" ]; key = "G"; action = "noop"; }
|
||||
{ map = [ "index" ]; key = "q"; action = "noop";}
|
||||
{ map = [ "pager" ]; key = "Q"; action = "noop";}
|
||||
{ map = [ "attach" "browser" "index" ]; key = "gg"; action = "first-entry";}
|
||||
{ map = [ "attach" "browser" "index" ]; key = "G"; action = "last-entry";}
|
||||
{ map = [ "pager" ]; key = "gg"; action = "top"; }
|
||||
{ map = [ "pager" ]; key = "G"; action = "bottom"; }
|
||||
{ map = [ "pager" ]; key = "k"; action = "previous-line"; }
|
||||
{ map = [ "pager" ]; key = "j"; action = "next-line"; }
|
||||
{
|
||||
map = ["attach" "browser" "index" "pager"];
|
||||
key = "g";
|
||||
action = "noop";
|
||||
}
|
||||
{
|
||||
map = ["attach" "browser" "index" "pager"];
|
||||
key = "G";
|
||||
action = "noop";
|
||||
}
|
||||
{
|
||||
map = ["index"];
|
||||
key = "q";
|
||||
action = "noop";
|
||||
}
|
||||
{
|
||||
map = ["pager"];
|
||||
key = "Q";
|
||||
action = "noop";
|
||||
}
|
||||
{
|
||||
map = ["attach" "browser" "index"];
|
||||
key = "gg";
|
||||
action = "first-entry";
|
||||
}
|
||||
{
|
||||
map = ["attach" "browser" "index"];
|
||||
key = "G";
|
||||
action = "last-entry";
|
||||
}
|
||||
{
|
||||
map = ["pager"];
|
||||
key = "gg";
|
||||
action = "top";
|
||||
}
|
||||
{
|
||||
map = ["pager"];
|
||||
key = "G";
|
||||
action = "bottom";
|
||||
}
|
||||
{
|
||||
map = ["pager"];
|
||||
key = "k";
|
||||
action = "previous-line";
|
||||
}
|
||||
{
|
||||
map = ["pager"];
|
||||
key = "j";
|
||||
action = "next-line";
|
||||
}
|
||||
|
||||
# Scrolling
|
||||
{ map = [ "attach" "browser" "pager" "index" ]; key = "\\CF"; action = "next-page";}
|
||||
{ map = [ "attach" "browser" "pager" "index" ]; key = "\\CB"; action = "previous-page";}
|
||||
{ map = [ "attach" "browser" "pager" "index" ]; key = "\\Cu"; action = "half-up";}
|
||||
{ map = [ "attach" "browser" "pager" "index" ]; key = "\\Cd"; action = "half-down";}
|
||||
{ map = [ "browser" "pager" ]; key = "\\Ce"; action = "next-line";}
|
||||
{ map = [ "browser" "pager" ]; key = "\\Cy"; action = "previous-line";}
|
||||
{ map = [ "index" ]; key = "\\Ce"; action = "next-line";}
|
||||
{ map = [ "index" ]; key = "\\Cy"; action = "previous-line";}
|
||||
{
|
||||
map = ["attach" "browser" "pager" "index"];
|
||||
key = "\\CF";
|
||||
action = "next-page";
|
||||
}
|
||||
{
|
||||
map = ["attach" "browser" "pager" "index"];
|
||||
key = "\\CB";
|
||||
action = "previous-page";
|
||||
}
|
||||
{
|
||||
map = ["attach" "browser" "pager" "index"];
|
||||
key = "\\Cu";
|
||||
action = "half-up";
|
||||
}
|
||||
{
|
||||
map = ["attach" "browser" "pager" "index"];
|
||||
key = "\\Cd";
|
||||
action = "half-down";
|
||||
}
|
||||
{
|
||||
map = ["browser" "pager"];
|
||||
key = "\\Ce";
|
||||
action = "next-line";
|
||||
}
|
||||
{
|
||||
map = ["browser" "pager"];
|
||||
key = "\\Cy";
|
||||
action = "previous-line";
|
||||
}
|
||||
{
|
||||
map = ["index"];
|
||||
key = "\\Ce";
|
||||
action = "next-line";
|
||||
}
|
||||
{
|
||||
map = ["index"];
|
||||
key = "\\Cy";
|
||||
action = "previous-line";
|
||||
}
|
||||
|
||||
# Reply
|
||||
{ map =[ "pager" "index" ]; key = "R"; action = "group-reply";}
|
||||
{
|
||||
map = ["pager" "index"];
|
||||
key = "R";
|
||||
action = "group-reply";
|
||||
}
|
||||
|
||||
# sidebar
|
||||
{ map = [ "index" "pager" ]; key = "<f12>"; action = "sidebar-toggle-visible";}
|
||||
{ map = [ "index" "pager" ]; key = "{"; action = "sidebar-prev";}
|
||||
{ map = [ "index" "pager" ]; key = "}"; action = "sidebar-next";}
|
||||
{ map = [ "index" "pager" ]; key = "|"; action = "sidebar-open";}
|
||||
{
|
||||
map = ["index" "pager"];
|
||||
key = "<f12>";
|
||||
action = "sidebar-toggle-visible";
|
||||
}
|
||||
{
|
||||
map = ["index" "pager"];
|
||||
key = "{";
|
||||
action = "sidebar-prev";
|
||||
}
|
||||
{
|
||||
map = ["index" "pager"];
|
||||
key = "}";
|
||||
action = "sidebar-next";
|
||||
}
|
||||
{
|
||||
map = ["index" "pager"];
|
||||
key = "|";
|
||||
action = "sidebar-open";
|
||||
}
|
||||
|
||||
# open virtual folder
|
||||
{ map = [ "index" "pager" ]; key = "X"; action = "noop";}
|
||||
{ map = [ "index" "pager" ]; key = "X"; action = "change-vfolder";}
|
||||
{
|
||||
map = ["index" "pager"];
|
||||
key = "X";
|
||||
action = "noop";
|
||||
}
|
||||
{
|
||||
map = ["index" "pager"];
|
||||
key = "X";
|
||||
action = "change-vfolder";
|
||||
}
|
||||
|
||||
# read entire thread of the current message
|
||||
{ map = [ "index" "pager" ]; key = "+"; action = "entire-thread";}
|
||||
{
|
||||
map = ["index" "pager"];
|
||||
key = "+";
|
||||
action = "entire-thread";
|
||||
}
|
||||
|
||||
# generate virtual folder from query
|
||||
{ map = [ "index" "pager" ]; key = "\\eX"; action = "vfolder-from-query";}
|
||||
{
|
||||
map = ["index" "pager"];
|
||||
key = "\\eX";
|
||||
action = "vfolder-from-query";
|
||||
}
|
||||
|
||||
# generate virtual folder from query with time window
|
||||
|
||||
{ map = [ "index" "pager" ]; key = "\\CD"; action = "modify-tags";}
|
||||
{
|
||||
map = ["index" "pager"];
|
||||
key = "\\CD";
|
||||
action = "modify-tags";
|
||||
}
|
||||
|
||||
# Editor
|
||||
{ map = [ "editor" ]; key = "<Tab>"; action = "complete-query";}
|
||||
{ map = [ "editor" ]; key = "^T"; action = "complete";}
|
||||
{
|
||||
map = ["editor"];
|
||||
key = "<Tab>";
|
||||
action = "complete-query";
|
||||
}
|
||||
{
|
||||
map = ["editor"];
|
||||
key = "^T";
|
||||
action = "complete";
|
||||
}
|
||||
];
|
||||
macros = [
|
||||
{ map = [ "pager" ]; key = "\\CB"; action = "<pipe-message>${pkgs.urlscan}/bin/urlscan -d -c --color true<Enter>"; }
|
||||
] ++ accountMacros;
|
||||
macros =
|
||||
[
|
||||
{
|
||||
map = ["pager"];
|
||||
key = "\\CB";
|
||||
action = "<pipe-message>${pkgs.urlscan}/bin/urlscan -d -c --color true<Enter>";
|
||||
}
|
||||
]
|
||||
++ accountMacros;
|
||||
};
|
||||
programs.mbsync = {
|
||||
enable = true;
|
||||
|
@ -234,7 +379,7 @@ in
|
|||
};
|
||||
programs.notmuch = {
|
||||
enable = true;
|
||||
new.tags = [ "new" ];
|
||||
new.tags = ["new"];
|
||||
hooks.postNew = ''
|
||||
${pkgs.afew}/bin/afew --tag --new
|
||||
${pkgs.afew}/bin/afew --move --all
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue