From 3fb3398f59d4c872e48e70306bf9f480b4b80425 Mon Sep 17 00:00:00 2001 From: cnst Date: Fri, 27 Dec 2024 18:41:40 +0100 Subject: [PATCH] small waybar change and adding protonmail-bridge --- modules/default.nix | 2 + modules/home/programs/aerc/default.nix | 213 ++++++++++++++++++ modules/home/programs/waybar/default.nix | 12 +- .../services/protonmail-bridge/default.nix | 31 +++ users/cnst/modules.nix | 7 + 5 files changed, 259 insertions(+), 6 deletions(-) create mode 100644 modules/home/programs/aerc/default.nix create mode 100644 modules/home/services/protonmail-bridge/default.nix diff --git a/modules/default.nix b/modules/default.nix index 02745172..8e324e69 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -2,6 +2,7 @@ flake.nixosModules = { home = { imports = [ + ./home/programs/aerc ./home/programs/alacritty ./home/programs/anyrun ./home/programs/bash @@ -42,6 +43,7 @@ ./home/services/hypridle ./home/services/hyprpaper ./home/services/mako + ./home/services/protonmail-bridge ./home/services/syncthing ./home/services/udiskie ./home/services/xdg diff --git a/modules/home/programs/aerc/default.nix b/modules/home/programs/aerc/default.nix new file mode 100644 index 00000000..eb7ae650 --- /dev/null +++ b/modules/home/programs/aerc/default.nix @@ -0,0 +1,213 @@ +{ + pkgs, + config, + lib, + ... +}: let + inherit (lib) mkIf mkEnableOption; + cfg = config.home.programs.aerc; +in { + options = { + home.programs.aerc.enable = mkEnableOption "Enables aerc"; + }; + config = mkIf cfg.enable { + programs = { + aerc = { + enable = true; + extraConfig = '' + [compose] + edit-headers = true + file-picker-cmd = fzf --multi --query=%s + reply-to-self = false + + [filters] + .headers = ${pkgs.aerc}/libexec/aerc/filters/colorize + text/calendar = ${pkgs.gawk}/bin/awk -f ${pkgs.aerc}/libexec/aerc/filters/calendar + text/html = ${pkgs.aerc}/libexec/aerc/filters/html | ${pkgs.aerc}/libexec/aerc/filters/colorize + text/plain = ${pkgs.aerc}/libexec/aerc/filters/colorize + text/* = ${pkgs.bat}/bin/bat -fP --file-name="$AERC_FILENAME " + message/delivery-status = ${pkgs.aerc}/libexec/aerc/filters/colorize + message/rfc822 = ${pkgs.aerc}/libexec/aerc/filters/colorize + application/pdf = ${pkgs.zathura}/bin/zathura - + application/x-sh = ${pkgs.bat}/bin/bat -fP -l sh + audio/* = ${pkgs.mpv}/bin/mpv - + + [general] + default-menu-cmd = ${pkgs.fzf}/bin/fzf + enable-osc8 = true + pgp-provider = gpg + unsafe-accounts-conf = true + + [viewer] + header-layout = From|To,Cc|Bcc,Date,Subject,DKIM+|SPF+|DMARC+ + + [ui] + tab-title-account = {{.Account}} {{if .Unread}}({{.Unread}}){{end}} + fuzzy-complete = true + mouse-enabled = true + msglist-scroll-offset = 5 + show-thread-context = true + thread-prefix-dummy = ┬ + thread-prefix-first-child = ┬ + thread-prefix-folded = + + thread-prefix-has-siblings = ├ + thread-prefix-indent = + thread-prefix-last-sibling = ╰ + thread-prefix-limb = ─ + thread-prefix-lone = + thread-prefix-orphan = ┌ + thread-prefix-stem = │ + thread-prefix-tip = + thread-prefix-unfolded = + threading-enabled = true + spinner="◜,◠,◝,◞,◡,◟" + ''; + + extraBinds = '' + = :prev-tab + = :next-tab + ? = :help keys + = :prompt 'Quit?' quit + = :prompt 'Quit?' quit + + [messages] + q = :prompt 'Quit?' quit + j = :next + k = :prev + = :next 50% + = :prev 50% + = :next 100% + = :prev 100% + g = :select 0 + G = :select -1 + J = :next-folder + K = :prev-folder + + = :mark -t:next + = :exec checkmail + = :view + d = :choose -o y 'Really delete this message' delete-message + a = :read:archive flat + A = :unmark -a:mark -T:read:mark -T:archive flat + s = :read:move Junk + + m = :compose + r = :reply -aq + $ = :term + ! = :term + | = :pipe + + / = :search + \ = :change-tab notmuch:cf + + = :query -n "{{.SubjectBase}} ({{.MessageId}})" -a notmuch thread:\{id:{{.MessageId}}\} + n = :next-result + N = :prev-result + = :clear + + v = :split + V = :vsplit + + [messages:folder=Drafts] + = :recall + + [view] + / = :toggle-key-passthrough/ + q = :close + o = :open + S = :save + | = :pipe + a = :archive flat + s = :move Junk + + = :open-link + + f = :forward + r = :reply -aq + + H = :toggle-headers + = :prev-part + = :next-part + J = :next + K = :prev + + [view::passthrough] + $noinherit = true + $ex = + = :toggle-key-passthrough + + [compose] + $noinherit = true + $ex = + + [compose::editor] + $noinherit = true + $ex = + + [compose::review] + y = :send # Send + n = :abort # Abort (discard message, no confirmation) + v = :preview # Preview message + p = :postpone # Postpone + q = :choose -o d discard abort -o p postpone postpone # Abort or postpone + e = :edit # Edit + a = :menu -c 'fd . --type=f | fzf -m' attach # Add attachment + d = :detach # Remove attachment + s = :sign # PGP sign + + [terminal] + $noinherit = true + $ex = + = :prev-tab + = :next-tab + ''; + }; + + # notmuch = { + # enable = true; + # new = { + # ignore = [ + # ".uidvalidity" + # ".mbsyncstate" + # ".mbsyncstate.lock" + # ".mbsyncstate.journal" + # ".mbsyncstate.new" + # ]; + # tags = ["unread" "inbox" "new"]; + # }; + # }; + + # msmtp.enable = true; + # mbsync.enable = true; + }; + + accounts.email = { + maildirBasePath = ".mail"; + accounts.protonmail = { + realName = "notmuch"; + address = "notmuch@localhost"; + aerc = { + enable = true; + extraAccounts.source = "notmuch://~/.mail"; + extraBinds.messages."r" = '':reply -aqA {{index (.Filename | split ("/")) 4}}''; + extraBinds.view."r" = '':reply -aqA {{index (.Filename | split ("/")) 4}}''; + }; + }; + }; + + # services = { + # imapnotify.enable = true; + # mbsync = { + # enable = true; + # postExec = "${lib.getExe' pkgs.maximbaz-scripts "indexmail"}"; + # }; + # }; + + # systemd.user.services.mbsync.Unit.After = ["sops-nix.service"]; + + # home.packages = with pkgs; [ + # aerc + # w3m + # dante + # ]; + }; +} diff --git a/modules/home/programs/waybar/default.nix b/modules/home/programs/waybar/default.nix index 4d1d9802..36d4b161 100644 --- a/modules/home/programs/waybar/default.nix +++ b/modules/home/programs/waybar/default.nix @@ -54,7 +54,7 @@ in { }; disable-scroll = true; rotate = 0; - all-outputs = true; + all-outputs = false; active-only = false; on-click = "activate"; persistent-workspaces = { @@ -143,7 +143,7 @@ in { }; clock = { - format = " {:%a, %d %b %H:%M}"; + format = " {:%a, %d %b %H:%M}"; rotate = 0; on-click = "calcurse-toggle.sh"; on-click-right = "calsync.sh"; @@ -200,12 +200,12 @@ in { }; pulseaudio = { - format = "{icon} {volume}% {format_source}"; + format = "{icon} {volume}% {format_source}"; on-scroll-up = "volume-control.sh --inc"; on-scroll-down = "volume-control.sh --dec"; - format-bluetooth = "{icon} {volume}% {format_source}"; - format-bluetooth-muted = " {icon} {format_source}"; - format-muted = " {format_source}"; + format-bluetooth = "{icon} {volume}% {format_source}"; + format-bluetooth-muted = " {icon} {format_source}"; + format-muted = " {format_source}"; format-source = " {volume}%"; format-source-muted = ""; format-icons = { diff --git a/modules/home/services/protonmail-bridge/default.nix b/modules/home/services/protonmail-bridge/default.nix new file mode 100644 index 00000000..be8d8f65 --- /dev/null +++ b/modules/home/services/protonmail-bridge/default.nix @@ -0,0 +1,31 @@ +{ + config, + lib, + pkgs, + ... +}: let + inherit (lib) mkIf mkEnableOption optionalString; + cfg = config.home.services.protonmail-bridge; +in { + options = { + home.services.protonmail-bridge.enable = mkEnableOption "Enables protonmail-bridge"; + }; + config = mkIf cfg.enable { + home.packages = [pkgs.protonmail-bridge]; + systemd.user.services.protonmail-bridge = { + Unit = { + Description = "Protonmail Bridge"; + After = ["network.target"]; + }; + + Service = { + Restart = "always"; + ExecStart = "${pkgs.protonmail-bridge}/bin/protonmail-bridge --no-window --noninteractive"; + }; + + Install = { + WantedBy = ["default.target"]; + }; + }; + }; +} diff --git a/users/cnst/modules.nix b/users/cnst/modules.nix index 2593d700..53371e9d 100644 --- a/users/cnst/modules.nix +++ b/users/cnst/modules.nix @@ -20,6 +20,10 @@ ]; home = { programs = { + aerc = { + enable = false; + }; + alacritty = { enable = true; }; @@ -141,6 +145,9 @@ mako = { enable = true; }; + protonmail-bridge = { + enable = true; + }; syncthing = { enable = true; };