diff options
| author | Mike Vink <mike1994vink@gmail.com> | 2023-06-28 18:50:01 +0200 |
|---|---|---|
| committer | Mike Vink <mike1994vink@gmail.com> | 2023-06-28 18:50:01 +0200 |
| commit | 9e8d19e610bd1b0114e61451d3f21c986b5cdf4b (patch) | |
| tree | 270504862cace65446cf0a58d524b25b35c11092 | |
| parent | f1e83ddd51b43c8eaa3def75794e2e403c9845ec (diff) | |
stuff
| -rw-r--r-- | email/gmail.nix | 5 | ||||
| -rw-r--r-- | email/neomutt.nix | 27 | ||||
| -rw-r--r-- | flake.nix | 4 | ||||
| -rw-r--r-- | home.nix | 58 | ||||
| m--------- | home/dwm | 0 | ||||
| -rw-r--r-- | home/st.nix | 74 | ||||
| -rw-r--r-- | home/suckless.nix | 80 | ||||
| -rw-r--r-- | overlays/suckless.nix | 18 | ||||
| -rw-r--r-- | shell-scripts/notmuch-hook | 13 | ||||
| -rw-r--r-- | shell-scripts/openfile | 10 |
10 files changed, 117 insertions, 172 deletions
diff --git a/email/gmail.nix b/email/gmail.nix index 751d677..43be078 100644 --- a/email/gmail.nix +++ b/email/gmail.nix @@ -16,9 +16,12 @@ passwordCommand = ["${pkgs.pass}/bin/pass" "personal/neomutt"]; imap = { host = "imap.gmail.com"; port = 993; tls = { enable = true; }; }; smtp = { host = "smtp.gmail.com"; port = 587; tls = { enable = true; useStartTls = true; }; }; + msmtp = { + enable = true; + }; neomutt = { enable = true; - sendMailCommand = "echo 'hi'"; + sendMailCommand = "msmtp -a gmail"; mailboxName = "=== gmail ==="; extraConfig = '' set spoolfile='Inbox' diff --git a/email/neomutt.nix b/email/neomutt.nix index 9271de2..a7ec0b9 100644 --- a/email/neomutt.nix +++ b/email/neomutt.nix @@ -5,13 +5,35 @@ home-manager, ... }: { + programs.msmtp = { + enable = true; + }; + + xdg.configFile."neomutt/mailcap" = { + text = '' + text/plain; $EDITOR %s ; + text/html; openfile %s ; nametemplate=%s.html + text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -dump -width=1024 %s; nametemplate=%s.html; copiousoutput; + image/*; openfile %s ; + video/*; setsid mpv --quiet %s &; copiousoutput + audio/*; mpv %s ; + application/pdf; openfile %s ; + application/pgp-encrypted; gpg -d '%s'; copiousoutput; + application/pgp-keys; gpg --import '%s'; copiousoutput; + application/x-subrip; $EDITOR %s ; + ''; + }; + programs.neomutt = { enable = true; sort = "reverse-date"; + sidebar = { + enable = true; + }; extraConfig = '' set use_threads=yes set send_charset="us-ascii:utf-8" - set mailcap_path = $HOME/.config/mutt/mailcap + set mailcap_path = $HOME/.config/neomutt/mailcap set mime_type_query_command = "file --mime-type -b %s" set date_format="%y/%m/%d %I:%M%p" set index_format="%2C %Z %?X?A& ? %D %-15.15F %s (%-4.4c)" @@ -124,9 +146,6 @@ mono body bold "^gpg: BAD signature from.*" color body red default "([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<>\"]" ''; - sidebar = { - enable = true; - }; binds = [ { map = ["index" "pager"]; key = "x"; action = "noop"; } { map = ["index" "pager"]; key = "i"; action = "noop"; } @@ -20,6 +20,7 @@ home-manager, ... }: let + home = builtins.getEnv "HOME"; username = builtins.getEnv "USER"; email = builtins.getEnv "EMAIL"; system = "x86_64-linux"; @@ -27,6 +28,7 @@ overlay = nixpkgs.lib.composeManyExtensions [ (import ./overlays/vimPlugins.nix {inherit pkgs;}) + (import ./overlays/suckless.nix {inherit pkgs home;}) # (import ./overlays/fennel-language-server.nix {inherit pkgs;}) ]; @@ -36,6 +38,7 @@ ]; inherit system; }; + in { nixosConfigurations.lemptop = nixpkgs.lib.nixosSystem { inherit system; @@ -53,6 +56,7 @@ ./home/newsboat.nix ./home/kakoune.nix ./home/mpv.nix + ./home/zathura.nix ./email/gmail.nix ./email/mailsync.nix ./email/neomutt.nix @@ -11,6 +11,28 @@ home.stateVersion = "23.05"; xdg = { enable = true; + mimeApps = { + enable = true; + defaultApplications = { + "text/x-shellscript" = ["text.desktop"]; + "x-scheme-handler/magnet" = ["torrent.desktop"]; + "application/x-bittorrent" = ["torrent.desktop"]; + "x-scheme-handler/mailto" = ["mail.desktop"]; + "text/plain" = ["text.desktop"]; + "application/postscript" = ["pdf.desktop"]; + "application/pdf" = ["pdf.desktop"]; + "image/png" = ["img.desktop"]; + "image/jpeg" = ["img.desktop"]; + "image/gif" = ["img.desktop"]; + "application/rss+xml" = ["rss.desktop"]; + "video/x-matroska" = ["video.desktop"]; + "video/mp4" = ["video.desktop"]; + "x-scheme-handler/lbry" = ["lbry.desktop"]; + "inode/directory" = ["file.desktop"]; + }; + }; + desktopEntries = { + }; }; fonts.fontconfig.enable = true; @@ -88,25 +110,25 @@ export COLORTERM=truecolor ''; shellAliases = { - e = "kakup "; - es = "kakup ."; - k9s = "k9s"; - k = "kubectl "; - d = "docker "; - ls = "ls --color=auto"; - s = "sudo nixos-rebuild switch --flake ${config.home.homeDirectory}/flake#"; - b = "/run/current-system/bin/switch-to-configuration boot"; - h = "home-manager switch --flake ${config.home.homeDirectory}/flake#mvinkio --impure"; - fa = "azdo-switch-project"; - v = "nvim"; - V = "nvim -S .vimsession.vim"; - M = "xrandr --output HDMI1 --auto --output eDP1 --off"; - m = "xrandr --output eDP1 --auto --output HDMI1 --off"; - mM = "xrandr --output eDP1 --auto --output HDMI1 --off"; - newflake = "nix flake new -t ~/flake "; + e = "kakup "; + es = "kakup -f"; + k9s = "k9s"; + k = "kubectl "; + d = "docker "; + ls = "ls --color=auto"; + s = "sudo nixos-rebuild switch --flake ${config.home.homeDirectory}/flake#"; + b = "/run/current-system/bin/switch-to-configuration boot"; + h = "home-manager switch --flake ${config.home.homeDirectory}/flake#mvinkio --impure"; + fa = "azdo-switch-project"; + v = "nvim"; + V = "nvim -S .vimsession.vim"; + M = "xrandr --output HDMI1 --auto --output eDP1 --off"; + m = "xrandr --output eDP1 --auto --output HDMI1 --off"; + mM = "xrandr --output eDP1 --auto --output HDMI1 --off"; + newflake = "nix flake new -t ~/flake "; ansible-flake = "nix flake new -t ~/flake#ansible "; - go-flake = "nix flake new -t ~/flake#go "; - lock-pass = "gpgconf --kill gpg-agent"; + go-flake = "nix flake new -t ~/flake#go "; + lock-pass = "gpgconf --kill gpg-agent"; }; }; diff --git a/home/dwm b/home/dwm -Subproject 71560451d171b4fce469d1e6f6c3d21a0900a3e +Subproject 8aba66977b5f5234e252ce0df0ebc8f205cad20 diff --git a/home/st.nix b/home/st.nix deleted file mode 100644 index 69ef0ba..0000000 --- a/home/st.nix +++ /dev/null @@ -1,74 +0,0 @@ -{ - flake, - config, - pkgs, - home-manager, - ... -}: let - st-fork = with pkgs; (st.overrideAttrs (oldAttrs: rec { - src = fetchFromGitHub { - owner = "mvinkio"; - repo = "st"; - rev = "e03a7d3f0b6bf4028389a82d372d0f89a922b9da"; - sha256 = "sha256-xAMChf8DepEnIhb0/GluvcWWBm9d0Pgipm9HeRi1wUk="; - }; - buildInputs = oldAttrs.buildInputs ++ [harfbuzz]; - })); - - dwm-fork = with pkgs; (dwm.overrideAttrs (oldAttrs: rec { - src = (/. + config.home.homeDirectory + "/flake/home/dwm"); - })); - - dwm-xsession = { - enable = true; - initExtra = '' - ${dwm-fork}/bin/dwm - wal -R & - ${pkgs.xorg.xmodmap}/bin/xmodmap -e "remove mod1 = Alt_R" - ${pkgs.xorg.xmodmap}/bin/xmodmap -e "add mod3 = Alt_R" - ''; - }; - - spectrwm-xsession = { - enable = true; - initExtra = '' - wal -R & - ${pkgs.xorg.xmodmap}/bin/xmodmap -e "remove mod1 = Alt_R" - ${pkgs.xorg.xmodmap}/bin/xmodmap -e "add mod3 = Alt_R" - ''; - windowManager.spectrwm = { - enable = true; - programs = { - term = "st"; - search = "dmenu -ip -p 'Window name/id:'"; - browser = "firefox"; - lock = "slock"; - editor = "bash -c 'kakup'"; - projecteditor = "bash -c 'kakup .'"; - }; - bindings = { - lock = "Mod+s"; - browser = "Mod+w"; - term = "Mod+Return"; - restart = "Mod+Shift+r"; - quit = "Mod+Shift+q"; - editor = "Mod+e"; - projecteditor = "Mod+Shift+e"; - }; - settings = { - modkey = "Mod4"; - workspace_limit = 5; - focus_mode = "manual"; - focus_close = "next"; - bar_action = "spectrwmbar"; - bar_action_expand = 1; - bar_font_color = "grey, white, rgb:00/00/ff, rgb:ee/82/ee, rgb:4b/00/82, rgb:00/80/00, rgb:ff/ff/00, rgb:ff/a5/00, rgb:eb/40/34"; - }; - }; - }; -in { - xsession = if (true) then dwm-xsession else spectrwm-xsession; - home.packages = [ - st-fork - ]; -} diff --git a/home/suckless.nix b/home/suckless.nix index 03cace1..9bf3d1d 100644 --- a/home/suckless.nix +++ b/home/suckless.nix @@ -2,29 +2,11 @@ flake, config, pkgs, - home-manager, + suckless, ... }: let - st-fork = with pkgs; (st.overrideAttrs (oldAttrs: rec { - src = /. + config.home.homeDirectory + "/flake/home/st"; - buildInputs = oldAttrs.buildInputs ++ [harfbuzz]; - })); - - dwm-fork = with pkgs; (dwm.overrideAttrs (oldAttrs: rec { - src = /. + config.home.homeDirectory + "/flake/home/dwm"; - })); - - dwmblocks-fork = with pkgs; (stdenv.mkDerivation rec { - pname = "dwmblocks"; - version = "1.0"; - src = /. + config.home.homeDirectory + "/flake/home/dwmblocks"; - buildInputs = [xorg.libX11]; - installPhase = '' - install -m755 -D dwmblocks $out/bin/dwmblocks - ''; - }); - - dwm-xsession = { +in { + xsession = { enable = true; initExtra = '' ${pkgs.xorg.xmodmap}/bin/xmodmap -e "remove mod1 = Alt_R" @@ -34,49 +16,6 @@ dwmblocks & ''; }; - - spectrwm-xsession = { - enable = true; - initExtra = '' - wal -R & - ${pkgs.xorg.xmodmap}/bin/xmodmap -e "remove mod1 = Alt_R" - ${pkgs.xorg.xmodmap}/bin/xmodmap -e "add mod3 = Alt_R" - ''; - windowManager.spectrwm = { - enable = true; - programs = { - term = "st"; - search = "dmenu -ip -p 'Window name/id:'"; - browser = "firefox"; - lock = "slock"; - editor = "bash -c 'kakup'"; - projecteditor = "bash -c 'kakup .'"; - }; - bindings = { - lock = "Mod+s"; - browser = "Mod+w"; - term = "Mod+Return"; - restart = "Mod+Shift+r"; - quit = "Mod+Shift+q"; - editor = "Mod+e"; - projecteditor = "Mod+Shift+e"; - }; - settings = { - modkey = "Mod4"; - workspace_limit = 5; - focus_mode = "manual"; - focus_close = "next"; - bar_action = "spectrwmbar"; - bar_action_expand = 1; - bar_font_color = "grey, white, rgb:00/00/ff, rgb:ee/82/ee, rgb:4b/00/82, rgb:00/80/00, rgb:ff/ff/00, rgb:ff/a5/00, rgb:eb/40/34"; - }; - }; - }; -in { - xsession = - if true - then dwm-xsession - else spectrwm-xsession; services.picom = { enable = true; activeOpacity = 0.9; @@ -107,19 +46,16 @@ in { font = "Monospace 12"; format = "<b>%s</b>\\n%b"; }; - urgency_low = { background = "#1d2021"; foreground = "#928374"; timeout = 3; }; - urgency_normal = { foreground = "#ebdbb2"; background = "#458588"; timeout = 5; }; - urgency_critical = { background = "#1cc24d"; foreground = "#ebdbb2"; @@ -128,10 +64,10 @@ in { }; }; }; - home.packages = [ - st-fork - dwm-fork - dwmblocks-fork - pkgs.libnotify + home.packages = with pkgs; [ + st + dwm + dwmblocks + libnotify ]; } diff --git a/overlays/suckless.nix b/overlays/suckless.nix new file mode 100644 index 0000000..199a449 --- /dev/null +++ b/overlays/suckless.nix @@ -0,0 +1,18 @@ +{pkgs, home, ...}: (final: prev: { + st = (prev.st.overrideAttrs (oldAttrs: rec { + src = /. + home + "/flake/home/st"; + buildInputs = oldAttrs.buildInputs ++ [prev.harfbuzz]; + })); + dwm = (prev.dwm.overrideAttrs (oldAttrs: rec { + src = /. + home + "/flake/home/dwm"; + })); + dwmblocks =(prev.stdenv.mkDerivation rec { + pname = "dwmblocks"; + version = "1.0"; + src = /. + home + "/flake/home/dwmblocks"; + buildInputs = [prev.xorg.libX11]; + installPhase = '' + install -m755 -D dwmblocks $out/bin/dwmblocks + ''; + }); +}) diff --git a/shell-scripts/notmuch-hook b/shell-scripts/notmuch-hook index 268f315..12e2d05 100644 --- a/shell-scripts/notmuch-hook +++ b/shell-scripts/notmuch-hook @@ -1,10 +1,17 @@ . <(pass show personal/notmuch) notmuch new --quiet -notmuch tag -new +jobs -- from:jobs-listing* or from:jobs-noreply* -notmuch tag -new +houses -- from:"$MAKELAAR" or thread:"{$MAKELAAR}" -notmuch tag -new -inbox +dev -- from:/.*github.com/ or thread:"{from:/.*github.com/}" +notmuch tag -new +unread +jobs -- 'tag:new and (from:jobs-listings* or from:jobs-noreply*)' +notmuch tag -new +unread +houses -- 'tag:new and (from:"'$MAKELAAR'" or thread:{'$MAKELAAR'})' +notmuch tag -new -inbox +unread +dev -- 'tag:new and (from:/.*github.com/ or thread:{from:/.*github.com/})' notmuch tag -new +inbox +unread -- tag:new and path:gmail/Inbox/** + +# Gmail + mbsync = a lot of duplicates due to the archive notmuch tag -new +archive -- 'path:gmail/Archive/** -path:gmail/Inbox/** -path:gmail/[Gmail]/** -path:gmail/FarDrafts/** -path:gmail/Important/** -path:gmail/Sent/**' + +# Tag messages with files that were moved to trash in neomutt notmuch tag --remove-all +trash -- path:gmail/Trash/** +# Same but with messages with files that were moved to spam notmuch tag --remove-all +spam -- folder:/Spam/ +# Remove files of messages that were tagged but still have files left behind in the mailbox, should be fine since gmail already keeps a duplicate in the Archive so the message will not be deleted only one file of the message +notmuch search --output=files -- 'path:gmail/Inbox/** -tag:inbox' | grep Inbox | xargs >/dev/null 2>&1 rm diff --git a/shell-scripts/openfile b/shell-scripts/openfile new file mode 100644 index 0000000..0f60b10 --- /dev/null +++ b/shell-scripts/openfile @@ -0,0 +1,10 @@ +#!/bin/sh + +# Helps open a file with xdg-open from mutt in a external program without weird side effects. +tempdir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard/files" +file="$tempdir/${1##*/}" +[ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid -f xdg-open" +mkdir -p "$tempdir" +cp -f "$1" "$file" +$opener "$file" >/dev/null 2>&1 +find "${tempdir:?}" -mtime +1 -type f -delete |
