From 0cd88af42bd7d8f827b1854b99b8569cae2ef609 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Tue, 15 Jul 2025 21:36:05 +0200 Subject: [PATCH 1/2] fix(mako): syntax error in generated config file --- flake.lock | 41 ++++- flake.nix | 23 +-- hosts/morty/home-config.nix | 9 +- .../home-manager/accounts/email/default.nix | 153 ++++++++++++++++++ .../accounts/email/files/default.theme | 91 +++++++++++ .../accounts/email/files/ubordeaux.map | 2 + modules/home-manager/default.nix | 1 + .../desktop/sway/includes/mako.nix | 14 +- 8 files changed, 313 insertions(+), 21 deletions(-) create mode 100644 modules/home-manager/accounts/email/default.nix create mode 100644 modules/home-manager/accounts/email/files/default.theme create mode 100644 modules/home-manager/accounts/email/files/ubordeaux.map diff --git a/flake.lock b/flake.lock index da4e55b..92ba9c5 100644 --- a/flake.lock +++ b/flake.lock @@ -56,6 +56,26 @@ "type": "github" } }, + "nix-private": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1753832018, + "narHash": "sha256-5Bzgfzy6PNppiZC9TmunBVyxZYh4pbctHyizxyNgiq8=", + "ref": "main", + "rev": "a87fde2a8776983419bf8828dcde50835e094798", + "shallow": true, + "type": "git", + "url": "ssh://git@git.epha.se:24422/ephase/nix-private.git" + }, + "original": { + "ref": "main", + "shallow": true, + "type": "git", + "url": "ssh://git@git.epha.se:24422/ephase/nix-private.git" + } + }, "nixgl": { "inputs": { "flake-utils": "flake-utils", @@ -78,6 +98,20 @@ } }, "nixpkgs": { + "locked": { + "lastModified": 1753722563, + "narHash": "sha256-FK8iq76wlacriq3u0kFCehsRYTAqjA9nfprpiSWRWIc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "648f70160c03151bc2121d179291337ad6bc564b", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1748693115, "narHash": "sha256-StSrWhklmDuXT93yc3GrTlb0cKSS0agTAxMGjLKAsY8=", @@ -92,7 +126,7 @@ "type": "indirect" } }, - "nixpkgs_2": { + "nixpkgs_3": { "locked": { "lastModified": 1748693115, "narHash": "sha256-StSrWhklmDuXT93yc3GrTlb0cKSS0agTAxMGjLKAsY8=", @@ -111,7 +145,7 @@ "nur": { "inputs": { "flake-parts": "flake-parts", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs_3", "treefmt-nix": "treefmt-nix" }, "locked": { @@ -131,8 +165,9 @@ "root": { "inputs": { "home-manager": "home-manager", + "nix-private": "nix-private", "nixgl": "nixgl", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "nur": "nur", "sops-nix": "sops-nix" } diff --git a/flake.nix b/flake.nix index 84149e0..251eabc 100644 --- a/flake.nix +++ b/flake.nix @@ -15,20 +15,23 @@ url = "github:Mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; + nix-private = { + url = "git+ssh://git@git.epha.se:24422/ephase/nix-private.git?shallow=1&ref=main"; + }; }; outputs = { self, nixpkgs, home-manager, nur, nixgl, sops-nix, ... }@inputs: - let + let stateVersion = "23.11"; - + allSystems = [ "x86_64-linux" # 64bit AMD/Intel x86 "aarch64-linux" # 64bit ARM Linux ]; - + forAllSystems = fn: nixpkgs.lib.genAttrs allSystems (system: fn { pkgs = import nixpkgs { inherit system; }; }); - + createNixosSystem = { system, hostname, username ? "ephase" }: nixpkgs.lib.nixosSystem { system = system; specialArgs = { @@ -40,7 +43,7 @@ ./nixos/default.nix ]; }; - + createHomeConfiguration = { system ? "x86_64-linux", hostname, username ? "ephase" }: home-manager.lib.homeManagerConfiguration { pkgs = import nixpkgs { @@ -79,13 +82,13 @@ luci = createNixosSystem { system = "x86_64-linux"; hostname = "luci"; }; }; homeConfigurations = { - "rick" = createHomeConfiguration { system = "aarch64-linux"; hostname = "rick";}; - "luci" = createHomeConfiguration { system = "x86_64-linux"; hostname = "luci";}; - "morty" = createHomeConfiguration { system = "x86_64-linux"; hostname = "morty";}; - "mrmeeseeks" = createHomeConfiguration { system = "x86_64-linux"; hostname = "mrmeeseeks";}; + "rick" = createHomeConfiguration { system = "aarch64-linux"; hostname = "rick";}; + "luci" = createHomeConfiguration { system = "x86_64-linux"; hostname = "luci";}; + "morty" = createHomeConfiguration { system = "x86_64-linux"; hostname = "morty";}; + "mrmeeseeks" = createHomeConfiguration { system = "x86_64-linux"; hostname = "mrmeeseeks";}; "work" = createHomeConfiguration { system = "x86_64-linux"; - hostname = "work"; + hostname = "work"; username = "yorick-barbanneau"; }; }; diff --git a/hosts/morty/home-config.nix b/hosts/morty/home-config.nix index afb756a..fc9bf9f 100644 --- a/hosts/morty/home-config.nix +++ b/hosts/morty/home-config.nix @@ -1,5 +1,12 @@ -{ ... }: { +{ inputs, ... }: { config.modules = { + email = { + enable = true; + accountConfigs = { + ubordeaux = inputs.nix-private.mail.ubordeaux; + }; + primary = "ubordeaux"; + }; application = { gnupg = { enable = true; diff --git a/modules/home-manager/accounts/email/default.nix b/modules/home-manager/accounts/email/default.nix new file mode 100644 index 0000000..71c7e11 --- /dev/null +++ b/modules/home-manager/accounts/email/default.nix @@ -0,0 +1,153 @@ +{ lib, config, pkgs, ... }: +with lib; +let + cfg = config.modules.email; +in +{ + options.modules.email = { + enable = mkEnableOption "Enable email accounts configuration"; + + accountConfigs = mkOption { + type = types.attrsOf types.attrs; + default = false; + description = "List of account variables used to create accounts"; + }; + + primary = mkOption { + type = types.str; + default = false; + description = "name of primary account"; + }; + }; + + config = mkIf cfg.enable { + accounts.email = let + defaultSetting = { + mbsync = { + enable = true; + create = "maildir"; + expunge = "both"; + }; + aerc = { + enable = true; + extraAccounts ={ + source = "notmuch://~/mail"; + maildir-store = "~/mail"; + default = "Inbox"; + postpone = "Drafts"; + copy-to = "Sent"; + use-envelope-from = true; + }; + }; + notmuch = { + enable = true; + }; + }; + accountsList = lib.mapAttrs ( name: value: lib.recursiveUpdate defaultSetting value.config ) cfg.accountConfigs; + in { + maildirBasePath = "mail"; + accounts = lib.recursiveUpdate accountsList { "${cfg.primary}".primary = true; }; + }; + + # programs.notmuch = { + # enable = true; + # new.tags = [ "new" ]; + # hooks.postNew = '' + # ${pkgs.afew}/bin/afew -t -n + # ${pkgs.afew}/bin/afew -w -n + # ''; + # }; + + programs.afew = { + enable = true; + extraConfig = '' + [FolderNameFilter] + folder_explicit_list = archives + folder_transforms = archives:archive + maildir_separator = / + [MailMover] + [SpamFilter] + [KillThreadsFilter] + [ArchiveSentMailsFilter] + sent_tag = sent + [InboxFilter] + ''; + }; + programs.aerc = { + enable = true; + extraConfig = { + general = { + unsafe-accounts-conf = true; + }; + ui = { + column-subject = '' + {{if .ThreadPrefix}}{{.Style (printf "%s " .ThreadPrefix) "thread"}}{{- end }}{{.Subject}} + ''; + column-flags = '' + {{.Flags | join " "}} + ''; + index-columns = '' + flags:5,name<20%,subject,date>= + ''; + thread-prefix-tip = "╼ "; + thread-prefix-indent = ""; + thread-prefix-stem = "│"; + thread-prefix-limb = "─"; + thread-prefix-folded = "+"; + thread-prefix-unfolded = ""; + thread-prefix-first-child = "┬"; + thread-prefix-has-siblings = "├"; + thread-prefix-orphan = "┬╼ "; + thread-prefix-dummy = "┬"; + thread-prefix-lone = " "; + thread-prefix-last-sibling = "╰"; + completion-popovers = true; + icon-attachment = "󰁦"; + icon-replied = ""; + icon-forwarded = ""; + icon-new = ""; + icon-old = ""; + icon-unencrypted = ""; + icon-encrypted = ""; + icon-signed = "󰏫"; + icon-signed-encrypted = ""; + icon-invalid = "󰏯"; + icon-unknown = "󰷭"; + threading-enabled = true; + }; + statusline = { + status-columns='' + left<*,right>* + ''; + column-left = '' + {{.Style (printf " %s " (toUpper .Account)) "statusline_account" }}\ + {{.Style (printf "  %s | 󰉉 %s " .Folder (humanReadable .Size)) "statusline_folder"}}\ + {{ if .ContentInfo }}{{.Style (printf " %s " .ContentInfo) "statusline_contentinfo"}}{{- end }} + ''; + column-center = '' + {{.Style .PendingKeys "statusline_center"}} + ''; + }; + filters = { + "text/plain" = " wrap -w 100 | colorize"; + "text/html" = "! html"; + "text/calendar" = "calendar"; + "message/delivery-status" = "colorize"; + "message/rfc822" = "colorize"; + ".headers" = "colorize"; + }; + }; + stylesets = { + default = (builtins.readFile ./files/default.theme); + }; + }; + programs.mbsync = { + enable = true; + }; + services.mbsync = { + enable = true; + postExec = "${pkgs.notmuch}/bin/notmuch new"; + package = config.programs.mbsync.package; + }; + }; +} diff --git a/modules/home-manager/accounts/email/files/default.theme b/modules/home-manager/accounts/email/files/default.theme new file mode 100644 index 0000000..6c8f522 --- /dev/null +++ b/modules/home-manager/accounts/email/files/default.theme @@ -0,0 +1,91 @@ +*.default=true +*.normal=true +border.fg=16 + +title.fg=5 +title.bg=0 + + +msglist_*.selected.bold=true +msglist_default.selected.bg=19 +msglist_default.selected.fg=7 + +msglist_flagged.italic=true + +msglist_marked.fg=0 +msglist_marked.bg=4 +msglist_marked.selected.fg=4 +msglist_marked.selected.bg= +msglist_marked.italic=true + +msglist_result.fg=0 +msglist_result.bg=3 +msglist_result.italic=true +msglist_result.selected.fg=3 +msglist_result.selected.bg= + +msglist_pill.bg=8 + +dirlist_*.selected.bold=true +dirlist_*.selected.bg=19 + +part_switcher.fg=7 +part_switcher.bg=19 +part_switcher.selected.bg=18 + +part_filename.bg=18 +part_filename.selected.bg=8 + +part_mimetype.bg=18 +part_mimetype.selected.bg=18 +part_mimetype.selected.dim=true + +statusline_error.fg=0 +statusline_error.bg=1 +statusline_error.bold=true + +statusline_success.fg=0 +statusline_success.bg=2 +statusline_success.bold=true + +completion_default.bg=18 +completion_default.fg=20 + +completion_description.bg=18 +completion_description.fg=20 + +completion_default.selected.fg=7 +completion_default.selected.bg=8 + +completion_description.selected.fg=7 +completion_description.selected.bg=8 + +selector_*.bg=18 + +tab.fg=15 +tab.bg=19 +tab.selected.fg=15 +tab.selected.bg=0 + +[viewer] +url.fg=4 +url.underline=true +header.fg=1 +header.bold=true +signature.dim=true +diff_meta.bold=true +diff_chunk.fg=#89b4fa +diff_chunk_func.fg=#89b4fa +diff_chunk_func.bold=true +diff_add.fg=#a6e3a1 +diff_del.fg=#f38ba8 +quote_*.fg=8 +quote_1.fg=17 + +[user] +thread.fg=1 +statusline_account.bg=4 +statusline_account.fg=0 +statusline_account.bold=true +statusline_folder.bg=18 +statusline_contentinfo.bg=19 diff --git a/modules/home-manager/accounts/email/files/ubordeaux.map b/modules/home-manager/accounts/email/files/ubordeaux.map new file mode 100644 index 0000000..0c29c2e --- /dev/null +++ b/modules/home-manager/accounts/email/files/ubordeaux.map @@ -0,0 +1,2 @@ +_Inbox=folder:ubordeaux/Inbox +_Sent=folder:ubordeaux/Sent diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index b17aa6f..ff73a9f 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -25,5 +25,6 @@ ./web/qutebrowser/default.nix ./web/webcord ./accounts/dav + ./accounts/email ]; } diff --git a/modules/home-manager/desktop/sway/includes/mako.nix b/modules/home-manager/desktop/sway/includes/mako.nix index 323e831..3b8d3df 100644 --- a/modules/home-manager/desktop/sway/includes/mako.nix +++ b/modules/home-manager/desktop/sway/includes/mako.nix @@ -15,16 +15,16 @@ with lib; enable = true; settings = { font = "Fira Code Nerd Font 10"; - backgroundColor = "#353535FF"; - borderColor = "#1CD180"; - progressColor = "over #5566AAFF"; - textColor = "#FDFDFD"; + background-color = "#353535"; + border-color = "#1CD180"; + progress-color = "over #5566AA"; + text-color = "#FDFDFD"; width = 300; height = 100; - borderRadius = 0; - borderSize = 2; + border-radius = 0; + border-size = 2; icons = true; - maxIconSize = 64; + max-icon-size = 64; layer = "overlay"; anchor = "top-right"; format = '' From fdb39267a6c323a6617cd531c56195165ae93e6f Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Mon, 4 Aug 2025 02:04:30 +0200 Subject: [PATCH 2/2] feat(accounts): add emails workflow serttings --- flake.lock | 6 +- hosts/morty/home-config.nix | 3 +- hosts/morty/includes/home-manager.nix | 3 +- .../home-manager/accounts/email/default.nix | 241 +++++++++++------- .../accounts/email/files/default.theme | 91 ------- .../accounts/email/files/theme.muttrc | 117 +++++++++ .../accounts/email/files/ubordeaux.map | 2 - 7 files changed, 279 insertions(+), 184 deletions(-) delete mode 100644 modules/home-manager/accounts/email/files/default.theme create mode 100644 modules/home-manager/accounts/email/files/theme.muttrc delete mode 100644 modules/home-manager/accounts/email/files/ubordeaux.map diff --git a/flake.lock b/flake.lock index 92ba9c5..c463d50 100644 --- a/flake.lock +++ b/flake.lock @@ -61,10 +61,10 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1753832018, - "narHash": "sha256-5Bzgfzy6PNppiZC9TmunBVyxZYh4pbctHyizxyNgiq8=", + "lastModified": 1754263742, + "narHash": "sha256-oPaO7L/lVAVHxdj7Yk6aAutj5mog4oTG+3Phib9gZ4s=", "ref": "main", - "rev": "a87fde2a8776983419bf8828dcde50835e094798", + "rev": "b37522e97284a35423d15bd627f3ebdcc4327870", "shallow": true, "type": "git", "url": "ssh://git@git.epha.se:24422/ephase/nix-private.git" diff --git a/hosts/morty/home-config.nix b/hosts/morty/home-config.nix index fc9bf9f..17453be 100644 --- a/hosts/morty/home-config.nix +++ b/hosts/morty/home-config.nix @@ -4,8 +4,9 @@ enable = true; accountConfigs = { ubordeaux = inputs.nix-private.mail.ubordeaux; + xiemeart = inputs.nix-private.mail.xiemeart; }; - primary = "ubordeaux"; + primary = "xiemeart"; }; application = { gnupg = { diff --git a/hosts/morty/includes/home-manager.nix b/hosts/morty/includes/home-manager.nix index cad60ba..9643c77 100644 --- a/hosts/morty/includes/home-manager.nix +++ b/hosts/morty/includes/home-manager.nix @@ -1,6 +1,6 @@ { ... }: { - home.file.".config/xkb/symbols/gpdwinmax".text = + home.file.".config/xkb/symbols/gpdwinmax".text = '' default partial alphanumeric_keys xkb_symbols "us-intl-winmax" { @@ -30,4 +30,5 @@ scale = "1.3"; }; }; + sops.age.keyFile = "/home/ephase/.config/sops/age/keys.txt"; } diff --git a/modules/home-manager/accounts/email/default.nix b/modules/home-manager/accounts/email/default.nix index 71c7e11..11b7bcc 100644 --- a/modules/home-manager/accounts/email/default.nix +++ b/modules/home-manager/accounts/email/default.nix @@ -1,7 +1,8 @@ -{ lib, config, pkgs, ... }: +{ lib, config, pkgs, inputs, ... }: with lib; let cfg = config.modules.email; + secretsDirectory = "${(builtins.toString inputs.nix-private)}/secrets"; in { options.modules.email = { @@ -21,6 +22,15 @@ in }; config = mkIf cfg.enable { + sops = let + secretList = lib.mapAttrs' ( name: value: + nameValuePair ( value.secret.key ) ({ + sopsFile = "${secretsDirectory}/${value.secret.file}"; + }) + ) cfg.accountConfigs; + in { + secrets = secretList; + }; accounts.email = let defaultSetting = { mbsync = { @@ -28,20 +38,16 @@ in create = "maildir"; expunge = "both"; }; - aerc = { + msmtp = { enable = true; - extraAccounts ={ - source = "notmuch://~/mail"; - maildir-store = "~/mail"; - default = "Inbox"; - postpone = "Drafts"; - copy-to = "Sent"; - use-envelope-from = true; - }; }; notmuch = { enable = true; }; + neomutt = { + enable = true; + showDefaultMailbox = false; + }; }; accountsList = lib.mapAttrs ( name: value: lib.recursiveUpdate defaultSetting value.config ) cfg.accountConfigs; in { @@ -49,16 +55,15 @@ in accounts = lib.recursiveUpdate accountsList { "${cfg.primary}".primary = true; }; }; - # programs.notmuch = { - # enable = true; - # new.tags = [ "new" ]; - # hooks.postNew = '' - # ${pkgs.afew}/bin/afew -t -n - # ${pkgs.afew}/bin/afew -w -n - # ''; - # }; - - programs.afew = { + programs.afew = let + mailMoverRules = lib.mergeAttrsList ( + lib.attrsets.mapAttrsToList ( + n: v: + if lib.hasAttrByPath ["afew" "mailMover"] v then + v.afew.mailMover + else {} + ) cfg.accountConfigs); + in { enable = true; extraConfig = '' [FolderNameFilter] @@ -66,6 +71,9 @@ in folder_transforms = archives:archive maildir_separator = / [MailMover] + folders = ${lib.concatStringsSep " " (lib.unique (lib.mapAttrsToList (n: v: "${n}") mailMoverRules))} + rename = True + ${lib.concatStringsSep "\n" (lib.mapAttrsToList (n: v: "${n} = ${toString v}") mailMoverRules)} [SpamFilter] [KillThreadsFilter] [ArchiveSentMailsFilter] @@ -73,73 +81,124 @@ in [InboxFilter] ''; }; - programs.aerc = { + programs.neomutt = let + accountMacros = lib.imap1 ( + i: + elem: elem // { + map = ["index" "pager"]; + key = ""; + }) ( + lib.attrsets.mapAttrsToList ( + n: _: + { "action" = "source ~/.config/neomutt/${n}=InboxUnread";} + ) inputs.nix-private.mail); + in { enable = true; - extraConfig = { - general = { - unsafe-accounts-conf = true; - }; - ui = { - column-subject = '' - {{if .ThreadPrefix}}{{.Style (printf "%s " .ThreadPrefix) "thread"}}{{- end }}{{.Subject}} - ''; - column-flags = '' - {{.Flags | join " "}} - ''; - index-columns = '' - flags:5,name<20%,subject,date>= - ''; - thread-prefix-tip = "╼ "; - thread-prefix-indent = ""; - thread-prefix-stem = "│"; - thread-prefix-limb = "─"; - thread-prefix-folded = "+"; - thread-prefix-unfolded = ""; - thread-prefix-first-child = "┬"; - thread-prefix-has-siblings = "├"; - thread-prefix-orphan = "┬╼ "; - thread-prefix-dummy = "┬"; - thread-prefix-lone = " "; - thread-prefix-last-sibling = "╰"; - completion-popovers = true; - icon-attachment = "󰁦"; - icon-replied = ""; - icon-forwarded = ""; - icon-new = ""; - icon-old = ""; - icon-unencrypted = ""; - icon-encrypted = ""; - icon-signed = "󰏫"; - icon-signed-encrypted = ""; - icon-invalid = "󰏯"; - icon-unknown = "󰷭"; - threading-enabled = true; - }; - statusline = { - status-columns='' - left<*,right>* - ''; - column-left = '' - {{.Style (printf " %s " (toUpper .Account)) "statusline_account" }}\ - {{.Style (printf "  %s | 󰉉 %s " .Folder (humanReadable .Size)) "statusline_folder"}}\ - {{ if .ContentInfo }}{{.Style (printf " %s " .ContentInfo) "statusline_contentinfo"}}{{- end }} - ''; - column-center = '' - {{.Style .PendingKeys "statusline_center"}} - ''; - }; - filters = { - "text/plain" = " wrap -w 100 | colorize"; - "text/html" = "! html"; - "text/calendar" = "calendar"; - "message/delivery-status" = "colorize"; - "message/rfc822" = "colorize"; - ".headers" = "colorize"; - }; - }; - stylesets = { - default = (builtins.readFile ./files/default.theme); + unmailboxes = true; + editor = "nvim +/^$/ +':nohl'"; + settings = { + sleep_time = "1"; + mbox_type = "Maildir"; + header_color_partial = "yes"; + duplicate_threads = "yes"; + index_format = "'%4C| %24.24?GS?%F %GS &%F? %?GR?%GR &%?GU?%GU & ??%?GA?%GA & ?%?GE?%GE & ?%?M?󰘕 %s&%s? %* %?g?  %g? %<[y?%<[m?%<[d?%9[%H:%M ]&%9[%a %d ]>&%9[%b %d ]>&%9[%m/%y ]>'"; + sort_aux = "last-date-sent"; + mail_check = "120"; + hidden_tags = "inbox,unread,draft,flagged,passed,replied,signed,encrypted,attachment,sent"; + markers = "no"; + wrap = "90"; + smart_wrap = "yes"; + reflow_text = "yes"; + reflow_wrap = "90"; + text_flowed = "yes"; + search_context = "3"; + pager_context = "5"; + pager_index_lines = "10"; + rfc2047_parameters = "yes"; + edit_headers = "yes"; + send_charset = "utf-8"; + envelope_from = "yes"; + my_status = "' %o/%m  | %l 󰉉 | %f %* Sort: %s-%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'"; }; + extraConfig = '' + ${(builtins.readFile ./files/theme.muttrc)} + charset-hook ^iso-8859-1$ cp1252 + ignore * + unignore from date subject to cc bcc tags user-agent x-mailer + 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" + ''; + 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"; } + + # 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";} + + # Delete + { map = [ "pager" "index" ]; key = "d "; action = "noop";} + { map = [ "pager" "index" ]; key = "dd "; action = "delete-message";} + + # Reply + { map =[ "pager" "index" ]; key = "R "; action = "group-reply";} + + # sidebar + { map = [ "index" "pager" ]; key = ""; 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";} + + # read entire thread of the current message + { map = [ "index" "pager" ]; key = "+"; action = "entire-thread";} + + # generate virtual folder from query + { map = [ "index" "pager" ]; key = "\\eX"; action = "vfolder-from-query";} + + # generate virtual folder from query with time window + { map = [ "index" ]; key = "<"; action = "vfolder-window-backward";} + { map = [ "index" ]; key = ">"; action = "vfolder-window-forward";} + + { map = [ "index" "pager" ]; key = "\\CD"; action = "modify-tags";} + + # Editor + { map = [ "editor" ]; key = ""; action = "complete-query";} + { map = [ "editor" ]; key = "^T "; action = "complete";} + ]; + macros = [ + #Define some macros here + ] ++ accountMacros; }; programs.mbsync = { enable = true; @@ -147,7 +206,17 @@ in services.mbsync = { enable = true; postExec = "${pkgs.notmuch}/bin/notmuch new"; - package = config.programs.mbsync.package; + }; + programs.notmuch = { + enable = true; + new.tags = [ "new" ]; + hooks.postNew = '' + ${pkgs.afew}/bin/afew --tag --new + ${pkgs.afew}/bin/afew --move --all + ''; + }; + programs.msmtp = { + enable = true; }; }; } diff --git a/modules/home-manager/accounts/email/files/default.theme b/modules/home-manager/accounts/email/files/default.theme deleted file mode 100644 index 6c8f522..0000000 --- a/modules/home-manager/accounts/email/files/default.theme +++ /dev/null @@ -1,91 +0,0 @@ -*.default=true -*.normal=true -border.fg=16 - -title.fg=5 -title.bg=0 - - -msglist_*.selected.bold=true -msglist_default.selected.bg=19 -msglist_default.selected.fg=7 - -msglist_flagged.italic=true - -msglist_marked.fg=0 -msglist_marked.bg=4 -msglist_marked.selected.fg=4 -msglist_marked.selected.bg= -msglist_marked.italic=true - -msglist_result.fg=0 -msglist_result.bg=3 -msglist_result.italic=true -msglist_result.selected.fg=3 -msglist_result.selected.bg= - -msglist_pill.bg=8 - -dirlist_*.selected.bold=true -dirlist_*.selected.bg=19 - -part_switcher.fg=7 -part_switcher.bg=19 -part_switcher.selected.bg=18 - -part_filename.bg=18 -part_filename.selected.bg=8 - -part_mimetype.bg=18 -part_mimetype.selected.bg=18 -part_mimetype.selected.dim=true - -statusline_error.fg=0 -statusline_error.bg=1 -statusline_error.bold=true - -statusline_success.fg=0 -statusline_success.bg=2 -statusline_success.bold=true - -completion_default.bg=18 -completion_default.fg=20 - -completion_description.bg=18 -completion_description.fg=20 - -completion_default.selected.fg=7 -completion_default.selected.bg=8 - -completion_description.selected.fg=7 -completion_description.selected.bg=8 - -selector_*.bg=18 - -tab.fg=15 -tab.bg=19 -tab.selected.fg=15 -tab.selected.bg=0 - -[viewer] -url.fg=4 -url.underline=true -header.fg=1 -header.bold=true -signature.dim=true -diff_meta.bold=true -diff_chunk.fg=#89b4fa -diff_chunk_func.fg=#89b4fa -diff_chunk_func.bold=true -diff_add.fg=#a6e3a1 -diff_del.fg=#f38ba8 -quote_*.fg=8 -quote_1.fg=17 - -[user] -thread.fg=1 -statusline_account.bg=4 -statusline_account.fg=0 -statusline_account.bold=true -statusline_folder.bg=18 -statusline_contentinfo.bg=19 diff --git a/modules/home-manager/accounts/email/files/theme.muttrc b/modules/home-manager/accounts/email/files/theme.muttrc new file mode 100644 index 0000000..e7ea68c --- /dev/null +++ b/modules/home-manager/accounts/email/files/theme.muttrc @@ -0,0 +1,117 @@ +# vi: ft=muttrc +# base16-mutt: base16-shell support for mutt + +## Base +color normal color20 default # softer, bold + +## Weak +color tilde color08 default # `~` padding at the end of pager +color attachment color08 default +color tree color01 default # arrow in threads +color signature color08 default +color markers color08 default # `+` wrap indicator in pager + +color underline color21 default + +color error color01 default +color message color04 default # informational messages +color search color08 color03 +color status color20 color18 +color indicator color21 color19 # inverse, brighter + +color status color00 color06 ' Pos: ([[:alnum:]]|%)+ ' +color status color20 color19 ' Sort: ([[:alpha:]]|-)+ ' + +# Message Index ---------------------------------------------------------------- + +## Index parts +color index_number color20 default +color index_author color20 default +color index_date color20 default +color index_flags color20 default +color index_tag color20 default +color index_tags color20 default + +color index_author italic color06 default "~g !~V" +color index_author color04 default "~g ~V" + +color index_subject color04 default "~G" + +color index_date color08 default + +color index_number color08 default +color index_subject bold color07 default "(~U|~N|~O)" + +color index_author italic color00 color06 "~T" +color index_subject italic color00 color06 "~T" +color index_date italic color00 color06 "~T" +color index_tags italic color00 color06 "~T" +color index_tag italic color00 color06 "~T" + +color index_subject italic bold color00 default "~T (~U|~N|~O)" + +## Weak +color index color01 default "~v~(~F)" # collapsed thread with flagged inside + +# Selection +color index italic color00 color06 "~T" # tagged messages +color index color01 color18 "~D" # deleted messages + +### Message Headers ---------------------------------------------------- + +# Base +set header_color_partial +hdr_order From Date: From: To: Cc: Subject: + +color header color04 default '^[^[:blank:]:]*:' +color hdrdefault color20 default +color header color17 default "^[Date:] (.*)" +color header color04 default "^From:" +color header color05 default "^Tags:" +color header color16 default "^(To|Cc|CC|BCC):" +color header brightcolor07 default "^Subject: (.*)" + +color header color06 color00 "((@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\]),)*@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\]):)?[0-9a-z_.+%$-]+@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0-2]?[0-9]?[0-9]\\.[0-2]?[0-9]?[0-9]\\.[0-2]?[0-9]?[0-9]\\.[0-2]?[0-9]?[0-9]\\])" + +### Message Body ------------------------------------------------------- +# When possible, these regular expressions attempt to match http://spec.commonmark.org/ +## Weak +# ~~~ Horizontal rules ~~~ +color body color08 color00 "([[:space:]]*[-+=#*~_]){3,}[[:space:]]*" +## Strong +# *Bold* span +color body brightcolor03 color00 "(^|[[:space:][:punct:]])\\*[^*]+\\*([[:space:][:punct:]]|$)" +# _Underline_ span +color body color05 color00 "(^|[[:space:][:punct:]])_[^_]+_([[:space:][:punct:]]|$)" +# /Italic/ span (Sometimes gets directory names) +color body color05 color00 "(^|[[:space:][:punct:]])/[^/]+/([[:space:][:punct:]]|$)" +# ATX headers +color body color04 color00 "^[[:space:]]{0,3}#+[[:space:]].*$" +## Highlight +# `Code` span +color body color02 color00 "(^|[[:space:][:punct:]])\`[^\`]+\`([[:space:][:punct:]]|$)" +# Indented code block +color body color02 color00 "^[[:space:]]{4,}.*$" +# URLs +color body italic color04 color00 "([a-z][a-z0-9+-]*://(((([a-z0-9_.!~*'();:&=+$,-]|%[0-9a-f][0-9a-f])*@)?((([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)(:[0-9]+)?)|([a-z0-9_.!~*'()$,;:@&=+-]|%[0-9a-f][0-9a-f])+)(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?(#([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?|(www|ftp)\\.(([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?(:[0-9]+)?(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?(#([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?)[^].,:;!)? \t\r\n<>\"]" +# Email addresses +color body color06 color00 "((@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\]),)*@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\]):)?[0-9a-z_.+%$-]+@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0-2]?[0-9]?[0-9]\\.[0-2]?[0-9]?[0-9]\\.[0-2]?[0-9]?[0-9]\\.[0-2]?[0-9]?[0-9]\\])" + +# Emoticons ;-P +color body black yellow "[;:][-o]?[})>{(<|P]" + +# PGP +color body color02 default "(Good signature)" +color body color01 default "(Bad signature)" +color body color16 default "(Problem signature)" +color body color04 color00 "^gpg: " + +## Quotation blocks +color quoted color06 color00 +color quoted1 color02 color00 +color quoted2 color03 color00 +color quoted3 color16 color00 +color quoted4 color01 color00 +color quoted5 color17 color00 +color quoted6 color05 color00 +color quoted7 color04 color00 diff --git a/modules/home-manager/accounts/email/files/ubordeaux.map b/modules/home-manager/accounts/email/files/ubordeaux.map deleted file mode 100644 index 0c29c2e..0000000 --- a/modules/home-manager/accounts/email/files/ubordeaux.map +++ /dev/null @@ -1,2 +0,0 @@ -_Inbox=folder:ubordeaux/Inbox -_Sent=folder:ubordeaux/Sent