citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

commit ac74544a56ce1255bf8d49ef0e8ab1760e37f943
parent bc3ccbd77bdf58060ddf6989d3900db575d89db6
Author: William Casarin <jb55@jb55.com>
Date:   Sat,  6 Nov 2021 14:19:38 -0700

updates

Diffstat:
Abin/callq | 2++
Mbin/curl-activity | 2+-
Mbin/fuzz-jump-tag | 11++---------
Mbin/fuzz-make | 2+-
Mbin/fuzz-search-file | 26++++++++++++++++++++------
Abin/fuzzdoc | 6++++++
Abin/fuzzedit | 6++++++
Abin/git-children-of | 10++++++++++
Abin/git-hash | 3+++
Mbin/lcli | 2+-
Mbin/memstat | 2+-
Mbin/nostat | 17+++--------------
Abin/project-root | 2++
Abin/repl | 15+++++++++++++++
Mbin/rfc | 2+-
Mbin/search-files | 2+-
Mbin/sedcut | 2+-
Mbin/spotify-service | 2+-
Abin/sql | 13+++++++++++++
Abin/timer | 20++++++++++++++++++++
Mdotfiles/.Xresources | 8++++----
Mdotfiles/.bash_aliases | 17++++++++---------
Mdotfiles/.bashrc | 2+-
Mdotfiles/.config/mimi/mime.conf | 8++++----
Mdotfiles/.config/neomutt/neomuttrc | 8++++++--
Mdotfiles/.config/nvim/init.vim | 27++++++++++++++++++++++++---
Mdotfiles/.config/qutebrowser/autoconfig.yml | 4++--
Mdotfiles/.config/qutebrowser/config.py | 2+-
Mdotfiles/.config/qutebrowser/quickmarks | 2++
Mdotfiles/.config/zathura/zathurarc | 2+-
Mdotfiles/.gitconfig | 5+++--
Mdotfiles/.vim/.vimrc | 389++++---------------------------------------------------------------------------
Mdotfiles/.xmonad/xmonad.hs | 12++++++++++--
Mdotfiles/commands | 29+++++++++++++++++------------
Mdotfiles/gemmarks | 2++
Mjb55pkgs/default.nix | 4++--
Mnix-config/environment/default.nix | 28++++++++++++++++++++++------
Mnix-config/environment/desktop/default.nix | 9+++++++--
Mnix-config/machines/monad/default.nix | 20++++++++++----------
Mnix-config/machines/monad/networking/default.nix | 3+--
Mnix-config/machines/quiver/default.nix | 41+++++++++++++++++++++++++++++++++++++++++
Mnix-config/machines/quiver/networking/default.nix | 59+++++++++++++++++++++++------------------------------------
Mnix-config/machines/quiver/timers/default.nix | 14++++++++++++++
Mnix-config/misc/imap-notifier/default.nix | 6++++--
Mnix-config/nixpkgs/config.nix | 36++++++------------------------------
45 files changed, 344 insertions(+), 540 deletions(-)

diff --git a/bin/callq b/bin/callq @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +objdump -d "$@" | grep callq | sedcut '<\([^>]*\)>' | sortur diff --git a/bin/curl-activity b/bin/curl-activity @@ -1,3 +1,3 @@ #!/usr/bin/env bash -curl -sL -H 'Accept: application/ld+json; profile="https://www.w3.org/ns/activitystreams"' "$@" | jq -C . +curl -sL -H 'Accept: application/ld+json; profile="https://www.w3.org/ns/activitystreams"' "$@" diff --git a/bin/fuzz-jump-tag b/bin/fuzz-jump-tag @@ -1,5 +1,4 @@ #!/usr/bin/env bash - set -eou pipefail TAGS=tags @@ -13,12 +12,6 @@ if [ ! -f tags ]; then fi fi -cutt() { - cut -d $'\t' --output-delimiter=$'\t' "$@" -} - -res=$(grep -v '^!_TAG' "$TAGS" | fzf) -file=$(<<<"$res" cutt -f2) -search=$(<<<"$res" cutt -f3- | sed -E -n 's,^([^"]+).*,\1,p') +tag=$(grep -v '!_TAG' "$TAGS" | fuzzer ^"$@" | cutt -f1) -printf "vim '%s' -c %q -c :noh\n" "$file" "$search" +echo "$EDITOR -t $tag" diff --git a/bin/fuzz-make b/bin/fuzz-make @@ -2,7 +2,7 @@ set -eou pipefail -cmd=$(grep '^[^#[:space:]].*:' Makefile | grep -v PHONY | cut -d: -f1 | sort | +cmd=$(grep '^[^#[:space:]].*:' Makefile | grep -v PHONY | cut -d: -f1 | sort -u | env FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --select-1 --exit-0" fuzzer "$@") echo $cmd diff --git a/bin/fuzz-search-file b/bin/fuzz-search-file @@ -1,8 +1,22 @@ #!/usr/bin/env bash -set -eou pipefail -file=$(rg --files | fuzzer "$@") +set -eo pipefail + +file="$1" +if [ -n $1 ]; then + if [ ! -f "$1" ]; then + file=$(rg --files | fuzzer "$1") + fi +else + file=$(rg --files | fuzzer) +fi + + file=$(readlink -f "$file") -batcmd="bat --color=always \"$file\" | cat -n | $FUZZER --ansi --tac | awk '{print \$1}'" -fuzz-record-command "$batcmd | xargs -I{} $EDITOR \"$file\" +\{\}" -line=$(eval $batcmd) -echo $EDITOR \"$file\" +$line +q="" +if [ -n "$2" ] && [ "$2" != "" ]; then + q="--query '$2'" +fi + +linecmd="awkt '{print \$0, NR}' '$file' | fzf --ansi --tac $q | sed -En 's,.*\t([0-9]+)$,\1,p'" +num=$(eval $linecmd) +echo ${3:-$EDITOR} +$num \"$file\" "# $(sed -n ${num}p "$file")" diff --git a/bin/fuzzdoc b/bin/fuzzdoc @@ -0,0 +1,6 @@ +#!/usr/bin/env sh +file=$1 +prefix=$2 +shift +shift +fuzz-search-file "$file" "$prefix $@" "less -S" diff --git a/bin/fuzzedit b/bin/fuzzedit @@ -0,0 +1,6 @@ +#!/usr/bin/env sh +file=$1 +prefix=$2 +shift +shift +fuzz-search-file "$file" "$prefix $@" edit diff --git a/bin/git-children-of b/bin/git-children-of @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +# given a commit, find immediate children of that commit. + +for arg in "$@"; do +for commit in $(git rev-parse $arg^0); do +for child in $(git log --format='%H %P' --all | grep -F " $commit" | cut -f1 -d' '); do + echo $child +done +done +done diff --git a/bin/git-hash b/bin/git-hash @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +git rev-parse HEAD | tee /dev/stderr | tr -d '\n' | xclip diff --git a/bin/lcli b/bin/lcli @@ -1,2 +1,2 @@ #!/usr/bin/env sh -$HOME/dev/github/ElementsProject/lightning/cli/lightning-cli --lightning-dir $HOME/.lightning "$@" +ssh monad /home/jb55/bin/lcli "$@" diff --git a/bin/memstat b/bin/memstat @@ -1,6 +1,6 @@ #!/usr/bin/env bash printf "hogs\n\n" -procmem | tail -n10 | nfmt +procmem | tail -n15 | nfmt all=$(procmemall) arc=$(arcsize) total=$(($all + $arc)) diff --git a/bin/nostat b/bin/nostat @@ -1,18 +1,9 @@ #!/usr/bin/env bash -services="home-email-notifier work-email-notifier email-notify-switcher" - -export SYSTEMD_COLORS=1 - ctl () { printf "%s-ing %s email notifier\n" "$1" "$2" >&2 } -if [ $# -eq 0 ] -then - printf "nostat [ARGS].. - ARGS: {+,-}h, +start, -stop\n" >&2 -fi - for var in "$@" do case $var in @@ -27,12 +18,10 @@ do esac done -printf '\n' >&2 - -res=$(ls -1 ~/var/notify) -if [ -z "$res" ] +res=off +if [ -f ~/var/notify/home ] then - res=off + res=on fi printf '%s\n' "$res" diff --git a/bin/project-root b/bin/project-root @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +exec git rev-parse --show-toplevel diff --git a/bin/repl b/bin/repl @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +cmd="$@" +name="$1" + +while true +do + printf "%s> " "$name" + + read args + + $cmd "$args" +done + +printf "\n" diff --git a/bin/rfc b/bin/rfc @@ -15,7 +15,7 @@ rfc_file="$RFC_DIR/rfc${1}.txt" if [ ! -f "$rfc_file" ] then - url="https://tools.ietf.org/rfc/rfc${1}.txt" + url="https://www.rfc-editor.org/rfc/rfc${1}.txt" curl --fail --compressed -s "$url" > "$rfc_file" || (rm -f "$rfc_file" && exit 1) fi diff --git a/bin/search-files b/bin/search-files @@ -10,4 +10,4 @@ res=$(fzf --bind "change:reload:$RG_PREFIX {q} || true" --ansi --phony --query " file=$(readlink -f $(cut -d: -f1 <<<"$res")) line=$(cut -d: -f2 <<<"$res") -echo \"$file\" +$line +echo +$line \"$file\" "# $(cut -d: -f4- <<<"$res")" diff --git a/bin/sedcut b/bin/sedcut @@ -1,2 +1,2 @@ #!/bin/sh -exec sed -n 's,.*'"$1"'.*,\1,p' +exec sed -E -n 's,.*'"$1"'.*,\1,p' diff --git a/bin/spotify-service b/bin/spotify-service @@ -1,6 +1,6 @@ #!/usr/bin/env bash options=$(dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames \ | grep spotify \ - | sedcut '"\([^"]\+\)"') + | sedcut '"([^"]+)"') grep 'spotify$' <<<"$options" || grep -v 'spotify$' <<<"$options" diff --git a/bin/sql b/bin/sql @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +dosql() { + local query="$1" + local args=("-U" "$pg_user" -A) + if [ ! -z "$query" ]; + then + args+=(-c "$query") + fi + psql -F $'\t' "${args[@]}" +} + +dosql "$@" | column -t -s $'\t' | less -S diff --git a/bin/timer b/bin/timer @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -e + +usage() { + printf "usage: timer "food is ready!" 10min\n" + exit 0 +} + +if [ -z "$1" ]; then + usage +fi + +now=$(date +%s) +target=$(date -d "$2" +%s) + +duration=$(($target - $now)) + +sleep $duration +notify-send -u critical "$1" diff --git a/dotfiles/.Xresources b/dotfiles/.Xresources @@ -20,8 +20,8 @@ URxvt.keysym.M-v: perl:keyboard-select:activate URxvt.keysym.M-s: perl:keyboard-select:search URxvt.keysym.M-f: perl:url-picker -URxvt.resize-font.smaller: M-j -URxvt.resize-font.bigger: M-k +URxvt.resize-font.smaller: M-9 +URxvt.resize-font.bigger: M-0 ! urxvt @@ -30,14 +30,14 @@ URxvt.resize-font.bigger: M-k !URxvt*font: xft:Source Code Pro:size=13:antialias=true;hinting=true,\ ! xft:Kochi Gothic:antialias=true,hinting=true !URxvt*font: xft:PT Mono:size=11 -URxvt*font: xft:Inconsolata:size=18:hinting=true +URxvt*font: xft:Inconsolata:size=20:hinting=true !urxvt.font: xft:terminus:antialias=false:pixelsize=16 !xft:Inconsolata:size=18:antialias=true;hinting=true ! /* URxvt*font: xft:Noto Serif:size=10:antialias=true;hinting=true */ -URxvt*internalBorder: 22 +URxvt*internalBorder: 14 URxvt*matcher.button: 1 URxvt.color-themes.autosave: 1 diff --git a/dotfiles/.bash_aliases b/dotfiles/.bash_aliases @@ -6,20 +6,19 @@ export PAGER="less" export LESS="-cix8RM --save-marks" -# mesa -export RADV_PERFTEST=aco -export AMD_DEBUG=nodma - TERM_THEME="$(basename $(readlink ~/.Xresources.d/themes/current))" if [ "$TERM_THEME" == "light" ] then export BAT_THEME=GitHub else - export BAT_THEME=base16 + export BAT_THEME=zenburn fi +export NNCPCFG=~/.nncprc export PANDOC=pandoc-nice +export MAIL=/home/jb55/var/notify/email-notify +export MAILREADER=/run/current-system/sw/bin/neomutt export BAT_STYLE=plain export LPASS_HOME="$HOME/.config/lpass" export FUZZER=fzf @@ -28,9 +27,6 @@ export GEMINICLIENT=av98 export GOPHER=$GOPHERCLIENT export GNUPGHOME="$HOME/.gnupg" export SHAREFILE_HOST='charon:public/s/' -export KINDLE_FROM_EMAIL='jackbox55@gmail.com' -export KINDLE_TXT_EMAIL='jb55@jb55.com' -export KINDLE_EMAIL='jb55@free.kindle.com' export SHAREFILE_URL='https://jb55.com/s/' export SHARE_SS_DIR="$HOME/var/img/ss" export DOTFILES=${DOTFILES:-$HOME/dotfiles} @@ -73,16 +69,19 @@ function run_fuzzer() { eval "$(fuzz-run-command "$@")" } +alias qud="steam-run ~/.local/share/Steam/steamapps/common/Caves\ of\ Qud/CoQ.x86_64" alias C="pcal list" alias Ci="pcal interactive" alias m="neomutt" +alias mt="f nt query:today" alias mq="msmtp-queue" +alias ibmgfx="cp437" alias s="general-status" alias t="todo.sh" alias e="edit -n" alias g=git -alias f=run_fuzzer alias vim=nvim +alias f=run_fuzzer alias feh="feh --conversion-timeout 2" alias info="info --vi-keys" alias ag="ag --pager=less" diff --git a/dotfiles/.bashrc b/dotfiles/.bashrc @@ -42,6 +42,6 @@ bind '"\C-x^": history-expand-line' bind '"\C-f": "\C-x\C-addi`fuzz-run-command`\C-x\C-e\C-x^\C-x\C-a$a\C-x\C-r"' bind -m vi-command '"\C-f": "i\C-f"' -bind '"\C-h": "\C-x\C-addi`fuzz-run-command sh`\C-x\C-e\C-x^\C-x\C-a$a\C-x\C-r"' +bind '"\eh": "\C-x\C-addi`fuzz-run-command sh`\C-x\C-e\C-x^\C-x\C-a$a\C-x\C-r"' bind -m vi-command '"\C-h": "i\C-h"' bind '"\C-l":clear-screen' diff --git a/dotfiles/.config/mimi/mime.conf b/dotfiles/.config/mimi/mime.conf @@ -1,6 +1,6 @@ txt: urxvtc -e lessr tsv: urxvtc -e sc-im -text/: edit +text/: urxvtc -e edit application/pdf: zathura djvu: zathura text/html: /home/jb55/bin/browser @@ -18,10 +18,10 @@ application/x-rar: urxvtc -e una application/x-xz: urxvtc -e una application/zip: urxvtc -e una inode/directory: urxvtc -e ranger -gopher: /home/jb55/bin/lagrange -gemini: /home/jb55/bin/lagrange +gopher: lagrange +gemini: lagrange zoommtg: zoom-us -mailto: urxvtc -e neomutt +mailto: urxvt -e neomutt spotify: /home/jb55/bin/spotify-open ps: zathura epub: zathura diff --git a/dotfiles/.config/neomutt/neomuttrc b/dotfiles/.config/neomutt/neomuttrc @@ -4,9 +4,10 @@ set sendmail="/home/jb55/bin/sendmail" set virtual_spoolfile=yes set folder="/home/jb55/mail/personal" set wait_key=no +set pager_stop=yes set from="jb55@jb55.com" set pipe_decode=yes -#set envelope_from=yes +set envelope_from=yes set mime_forward=no unset markers set text_flowed @@ -33,10 +34,13 @@ macro index,pager a "<modify-labels>-unread -inbox<enter>j<enter> macro index,pager A "<create-alias>" "Create alias" macro index,pager F "<modify-labels>+filed" "File message" macro index,pager + "<modify-labels>+" -macro index S "<modify-labels>+spam -unread -inbox" "Spam message" +macro index,pager S "<modify-labels>+spam -unread -inbox<enter>j<enter> macro index c "<change-vfolder>?" "Change to vfolder overview" macro index \\\\ "<vfolder-from-query>" "Search mailbox" macro pager p "|delta --paging always<enter>" +macro pager d "<next-page>" +macro pager u "<previous-page>" +macro pager c "|cols<enter>" macro pager P "|grep patch$ | xargs curl -sL | delta --paging always<enter>" my_hdr Bcc: William Casarin <jb55@jb55.com> diff --git a/dotfiles/.config/nvim/init.vim b/dotfiles/.config/nvim/init.vim @@ -9,21 +9,42 @@ set colorcolumn=80 set nowrap set hidden +hi ColorColumn ctermbg=8 + map Y y$ syntax on -set clipboard+=unnamedplus +set clipboard=unnamedplus let mapleader = "\\" let maplocalleader = "\\" nmap <Leader>xda ma:%s/\s\+$//g<CR>`a + +nmap <C-q> :q<CR> nmap <C-x> :x<CR> +nmap <C-s> ^D +nmap <C-n> :tn<CR> +nmap <C-p> :tp<CR> + +imap <A-j> { +imap <A-k> } +imap <A-n> [ +imap <A-m> ] +imap <A-h> ( +imap <A-l> ) +imap <A-u> _ +imap <A-i> - +imap <A-o> + +imap <A-,> = +imap <A-Space> <CR> autocmd FileType go autocmd BufWritePre <buffer> execute "normal! mz:mkview\<esc>:%!fmtsafe gofmt\<esc>:loadview\<esc>`z" +autocmd FileType go set wrap rnu autocmd FileType rust autocmd BufWritePre <buffer> execute "normal! mz:mkview\<esc>:%!fmtsafe rustfmt\<esc>:loadview\<esc>`z" -autocmd filetype javascript set sw=2 ts=2 expandtab +"autocmd filetype html set sw=2 ts=2 expandtab -autocmd filetype javascript set sw=2 ts=2 expandtab +autocmd BufEnter,BufNew *.nix set sw=2 ts=2 expandtab autocmd BufEnter,BufNew *.gmi set wrap linebreak + au BufWritePost,FileWritePost ~/.Xdefaults,~/.Xresources silent! !xrdb -load % >/dev/null 2>&1 diff --git a/dotfiles/.config/qutebrowser/autoconfig.yml b/dotfiles/.config/qutebrowser/autoconfig.yml @@ -6,5 +6,5 @@ config_version: 2 settings: - content.host_blocking.enabled: - global: false + content.proxy: + global: socks://172.24.0.1:9050 diff --git a/dotfiles/.config/qutebrowser/config.py b/dotfiles/.config/qutebrowser/config.py @@ -32,7 +32,7 @@ config.set('fonts.default_family', 'terminus') if hostname == 'monad': config.set('zoom.default', 125) else: - config.set('zoom.default', 150) + config.set('zoom.default', 125) # Editor (and arguments) to use for the `open-editor` command. The diff --git a/dotfiles/.config/qutebrowser/quickmarks b/dotfiles/.config/qutebrowser/quickmarks @@ -25,3 +25,5 @@ rbc https://www.rbcroyalbank.com/personal.html zlibrary https://ca1lib.org/ scihub https://sci-hub.se/ twitter https://tweetdeck.twitter.com/ +a https://webassembly.github.io/spec/core/exec/instructions.html#function-calls +topology-lectures https://www.youtube.com/playlist?list=PLRlVmXqzHjUQHEx63ZFxV-0Ortgf-rpJo diff --git a/dotfiles/.config/zathura/zathurarc b/dotfiles/.config/zathura/zathurarc @@ -11,4 +11,4 @@ set recolor-darkcolor "#afb6c3" set recolor-keephue "false" set scroll-page-aware "false" -set scroll-step 100 +set scroll-step 10 diff --git a/dotfiles/.gitconfig b/dotfiles/.gitconfig @@ -47,7 +47,6 @@ default = !git config branch.master.remote origin && git config branch.master.merge refs/heads/master ds = diff --staged ff = merge --ff-only - hash = !"git rev-parse HEAD | tr -d '\n' | xclip" lnd = log --no-decorate lg1 = log --graph --branches --tags --remotes --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %s %C(bold)— %an%C(reset)%C(bold yellow)%d%C(reset)' --abbrev-commit --date=relative lgl = log --format='%h %cr %s' @@ -88,7 +87,7 @@ enabled = false autoupdate = false [gpg] - program = ~/bin/ots-git + program = /home/jb55/bin/ots-git [magit] hideCampaign = true [github] @@ -99,3 +98,5 @@ lineNumber = true [credential "https://github.com"] helper = !gh auth git-credential +[init] + defaultBranch = master diff --git a/dotfiles/.vim/.vimrc b/dotfiles/.vim/.vimrc @@ -1,389 +1,38 @@ -" vim: foldmethod=marker: +inoremap <Esc> <Nop> +inoremap <special> fd <Esc> -"if 0 | endif - -filetype plugin indent on - -" Settings -set modeline -set modelines=1 -set nocp set tabstop=8 set shiftwidth=8 -set expandtab set ai set hlsearch -set hidden -set nowrap -set ruler set colorcolumn=80 -set t_Co=16 -highlight ColorColumn ctermbg=8 -set relativenumber -set dir=~/.vim/tmp -exe 'set t_kB=' . nr2char(27) . '[Z' -set vb t_vb= -syntax on - -if $VIM_CRONTAB == "true" - set nobackup - set nowritebackup -endif +set nowrap +set hidden -set clipboard+=unnamedplus +hi ColorColumn ctermbg=8 -" gvim fonts -" if has("gui_running") -" colorscheme molokai -" else -" set t_Co=256 -" set clipboard=unnamed -" colorscheme base16-onedark -" endif +map Y y$ -" +syntax on -" Mappings +set clipboard=unnamed -"call arpeggio#map('i', '', 0, 'fd', '<Esc>') -"let g:arpeggio_timeoutlen = 100 -"let mapleader = "\<SPACE>" -"let maplocalleader = "\<SPACE>" let mapleader = "\\" let maplocalleader = "\\" - -" digraphs - -nmap Q :qa<CR> - -" lambda λ -imap <C-d>j <C-k>l* -" approx equal ≅ -imap <C-d>a <C-k>?= -" subset ⊆ -imap <C-d>s <C-k>(_ -" element of ∈ -imap <C-d>e <C-k>(- -" right arrow → -imap <C-d>l <C-k>-> -" left arrow ← -imap <C-d>h <C-k><- -" compose ∘ -imap <C-d>o <C-k>Ob - -nnoremap <F10> :set invpaste paste?<CR> -imap <F10> <C-O><F10> -set pastetoggle=<F10> -nmap <F9> :TagbarToggle<CR> -map <F8> :make tags<CR> -map <F12> :TlistToggle<CR> -map <F11> :NERDTreeToggle<CR> -map <F2> :exec ":!hasktags -x -c --ignore src"<CR><CR> -map <F4> :call RCmd("make")<CR> -map <F5> :make<CR> -map <F6> :call RCmd("make test")<CR> -map <F7> :call RCmd("make deploy")<CR> - -nmap <Leader>nr "nyiW:call RCmd("npm repo <C-r>n")<CR> - -map <C-j> kddpkJ -map <Leader>] :tnext<CR> -map <Leader>[ :tprev<CR> -map <S-l> :cn<CR> -map <S-h> :cN<CR> -map <C-n> :lnext<CR> -map <C-p> :lprev<CR> -nmap <C-h> <C-w>h -nmap <C-l> <C-w>l -map <Leader>a :%s/\ at\ /\r\ at\ /g<CR> - -" Replace whitespace before and after commas -map <Leader>, :%s/\s\+,/,/g<CR>:%s/,\s\+/,/g<CR> - -map <Leader>y :Lodgeit<CR> -nmap <Leader>C :ccl<CR> -nmap <Leader>vs vip:sort<CR> nmap <Leader>xda ma:%s/\s\+$//g<CR>`a -nmap <Leader>rr :call ReloadSnippets(&filetype)<CR> -map <Leader><Leader>x :silent %!xmllint --encode UTF-8 --format -<CR> -vmap <Leader><Leader>x :!xmllint --encode UTF-8 --format -<CR> -vmap <Leader><Leader>j !jade -p % -o "{ prettyprint: true }"<CR> - -"map <Leader>cr :!newclay % && ./main<CR> - -cmap w!! %!sudo tee > /dev/null % - -" I never use ctrl-b anyways -nmap <C-b> <C-a> - -" Tabular bindings -nmap <Leader>== :Tabularize /=<CR> -vmap <Leader>== :Tabularize /=<CR> -nmap <Leader>=, :Tabularize /,<CR> -vmap <Leader>=, :Tabularize /,<CR> -nmap <Leader>=<Bar> :Tabularize /<Bar><CR> -vmap <Leader>=<Bar> :Tabularize /<Bar><CR> -nmap <Leader>=:: :Tabularize /::<CR> -vmap <Leader>=:: :Tabularize /::<CR> -nmap <Leader>=: :Tabularize /:\zs<CR> -vmap <Leader>=: :Tabularize /:\zs<CR> - -" Plugin Options - -let g:SuperTabDefaultCompletionType = "context" - -" For snippet_complete marker. -if has('conceal') - set conceallevel=2 concealcursor=i -endif - -let g:haddock_browser="open" - -let g:gitgutter_enabled = 1 -let g:indent_guides_auto_colors = 0 -let g:indent_guides_guide_size = 1 -let g:indent_guides_start_level = 2 -let g:indent_guides_enable_on_vim_startup = 1 - -let g:Powerline_symbols = 'fancy' - -let g:miniBufExplMapCTabSwitchBufs = 1 -let g:miniBufExplModSelTarget = 1 - -let g:clj_highlight_builtins=1 " Highlight Clojure's builtins -let g:clj_paren_rainbow=1 " Rainbow parentheses'! - -let g:SuperTabDefaultCompletionType = "context" - -let g:clang_complete_copen = 1 -let g:clang_snippets = 1 -let g:clang_use_library = 1 - -let g:syntastic_loc_list_height=3 -let g:syntastic_always_populate_loc_list = 1 -let g:syntastic_auto_loc_list = 1 -let g:syntastic_check_on_open = 1 -let g:syntastic_check_on_wq = 0 -let g:syntastic_coffee_coffeelint_conf = '~/.coffeelintrc' -let g:syntastic_enable_signs=1 -let g:syntastic_error_symbol='✗' -let g:syntastic_haskell_checkers = [] -let g:syntastic_javascript_checkers = ['eslint'] -let g:syntastic_javascript_eslint_args = '~/.eslintrc' -let g:syntastic_warning_symbol='⚠' -let g:EasyMotion_leader_key = '<Leader>' +nmap <C-q> :q<CR> +nmap <C-x> :x<CR> +nmap <C-s> ^D +nmap <C-n> :tn<CR> +nmap <C-p> :tp<CR> -let g:ctrlp_cmd = 'CtrlPMixed' -let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|\.git\|\.hg\|\.svn\|\.redo\|dist\|cabal-dev\|lib-cov' -let g:ctrlp_extensions = ['tag'] -let g:ctrlp_switch_buffer=0 +autocmd FileType go autocmd BufWritePre <buffer> execute "normal! mz:mkview\<esc>:%!fmtsafe gofmt\<esc>:loadview\<esc>`z" +autocmd FileType go set wrap rnu +autocmd FileType rust autocmd BufWritePre <buffer> execute "normal! mz:mkview\<esc>:%!fmtsafe rustfmt\<esc>:loadview\<esc>`z" +"autocmd filetype html set sw=2 ts=2 expandtab -" fix gitgutter color -highlight clear SignColumn +autocmd BufEnter,BufNew *.nix set sw=2 ts=2 expandtab +autocmd BufEnter,BufNew *.gmi set wrap linebreak -" Linux style C - - -if exists("g:loaded_linuxsty") - finish -endif -let g:loaded_linuxsty = 1 - -set wildignore+=*.ko,*.mod.c,*.order,modules.builtin - -augroup linuxsty - autocmd! - - autocmd FileType c,cpp call s:LinuxConfigure() - autocmd FileType diff setlocal ts=8 - autocmd FileType kconfig setlocal ts=8 sw=8 sts=8 noet - autocmd FileType dts setlocal ts=8 sw=8 sts=8 noet -augroup END - -function s:LinuxConfigure() - let apply_style = 0 - - if exists("g:linuxsty_patterns") - let path = expand('%:p') - for p in g:linuxsty_patterns - if path =~ p - let apply_style = 1 - break - endif - endfor - else - let apply_style = 1 - endif - - if apply_style - call s:LinuxCodingStyle() - endif -endfunction - -command! LinuxCodingStyle call s:LinuxCodingStyle() - -function! s:LinuxCodingStyle() - call s:LinuxFormatting() - call s:LinuxKeywords() - call s:LinuxHighlighting() -endfunction - -function s:LinuxFormatting() - setlocal tabstop=8 - setlocal shiftwidth=8 - setlocal softtabstop=8 - setlocal textwidth=80 - setlocal noexpandtab - - setlocal cindent - setlocal cinoptions=:0,l1,t0,g0,(0 -endfunction - -function s:LinuxKeywords() - syn keyword cOperator likely unlikely - syn keyword cType u8 u16 u32 u64 s8 s16 s32 s64 - syn keyword cType __u8 __u16 __u32 __u64 __s8 __s16 __s32 __s64 -endfunction - -function s:LinuxHighlighting() - highlight default link LinuxError ErrorMsg - - syn match LinuxError / \+\ze\t/ " spaces before tab - syn match LinuxError /\%>80v[^()\{\}\[\]<>]\+/ " virtual column 81 and more - - " Highlight trailing whitespace, unless we're in insert mode and the - " cursor's placed right after the whitespace. This prevents us from having - " to put up with whitespace being highlighted in the middle of typing - " something - autocmd InsertEnter * match LinuxError /\s\+\%#\@<!$/ - autocmd InsertLeave * match LinuxError /\s\+$/ -endfunction - -" Autocommands - -augroup encrypted - au! - - " First make sure nothing is written to ~/.viminfo while editing - " an encrypted file. - autocmd BufReadPre,FileReadPre *.gpg set viminfo= - " We don't want a various options which write unencrypted data to disk - autocmd BufReadPre,FileReadPre *.gpg set noswapfile noundofile nobackup - - " Switch to binary mode to read the encrypted file - autocmd BufReadPre,FileReadPre *.gpg set bin - autocmd BufReadPre,FileReadPre *.gpg let ch_save = &ch|set ch=2 - " (If you use tcsh, you may need to alter this line.) - autocmd BufReadPost,FileReadPost *.gpg '[,']!gpg2 --decrypt 2> /dev/null - - " Switch to normal mode for editing - autocmd BufReadPost,FileReadPost *.gpg set nobin - autocmd BufReadPost,FileReadPost *.gpg let &ch = ch_save|unlet ch_save - autocmd BufReadPost,FileReadPost *.gpg execute ":doautocmd BufReadPost " . expand("%:r") - - " Convert all text to encrypted text before writing - " (If you use tcsh, you may need to alter this line.) - autocmd BufWritePre,FileWritePre *.gpg '[,']!gpg2 --default-recipient-self -ae 2>/dev/null - " Undo the encryption so we are back in the normal text, directly - " after the file has been written. - autocmd BufWritePost,FileWritePost *.gpg u -augroup END - -"au BufEnter *.hs compiler ghc -au BufRead,BufNewFile *.nix set syn=nix -au BufRead,BufNewFile *.nix set filetype=nix -au BufRead,BufNewFile *.c,*.cpp,*.h set cindent -au BufRead,BufNewFile *.c,*.cpp,*.h set cino=(0 -au BufRead,BufNewFile *.clay set syn=clay -au BufRead,BufNewFile *.clj set syntax=clojure -au BufRead,BufNewFile *.coffee set ft=coffee -au BufRead,BufNewFile *.do set syn=sh -au BufRead,BufNewFile *.galaxy set syn=galaxy -au BufRead,BufNewFile *.glsl set syntax=glsl -au BufRead,BufNewFile *.gnu set syn=gnuplot -au BufRead,BufNewFile *.go set syntax=go -au BufRead,BufNewFile *.hx set syn=haxe -au BufRead,BufNewFile *.java set sw=4 -au BufRead,BufNewFile *.java set ts=4 -au BufRead,BufNewFile *.json set ft=json -au BufRead,BufNewFile *.less set syn=less -au BufRead,BufNewFile *.ll set syn=llvm -au BufRead,BufNewFile *.ly set syn=bn -au BufRead,BufNewFile *.material set syn=ogre3d_material -au BufRead,BufNewFile *.md,*.mkd,*.markdown set ft=markdown -au BufRead,BufNewFile *.mirah set syn=mirah -au BufRead,BufNewFile *.moon set syn=moon -au BufRead,BufNewFile *.rkt set syn=racket -au BufRead,BufNewFile *.rs set syn=rust -au BufRead,BufNewFile *.scala set syn=scala -au BufRead,BufNewFile *.swig set syn=swig -au BufRead,BufNewFile *.td set syn=tablegen -au BufRead,BufNewFile *.thrift set syn=thrift -au BufRead,BufNewFile *.ts set syn=typescript -au BufRead,BufNewFile *.ebnf set syn=ebnf -au BufRead,BufNewFile *.bnf set syn=bnf -au BufRead,BufNewFile *.ts set filetype=typescript -au BufRead,BufNewFile *.x set syn=alex -au BufRead,BufNewFile *.xsl let g:xml_syntax_folding = 1 -au BufRead,BufNewFile *.xsl set foldmethod=syntax -au BufRead,BufNewFile *.xsl set syn=xml -au BufRead,BufNewFile *.y set syn=bnf -au BufRead,BufNewFile *.y.pp set syn=happy -au BufRead,BufNewFile *.yaml set syn=yaml -au BufRead,BufNewFile *.yml set syn=yaml au BufWritePost,FileWritePost ~/.Xdefaults,~/.Xresources silent! !xrdb -load % >/dev/null 2>&1 -au BufRead,BufNewFile /etc/nginx/* set ft=nginx -au BufRead,BufNewFile nginx.conf set ft=nginx -au BufRead,BufNewFile wscript set syn=python -" - -" Commands - -function! PlaySound() -" uncomment to annoy coworkers -" silent! exec '!afplay ~/audio/typewriter_keystroke.wav &' -endfunction -autocmd CursorMovedI * call PlaySound() - -function! RCmd(cmd) - :silent! exe '!echo "cd ' . getcwd() . ' && ' . a:cmd . '" > /tmp/cmds' - :redraw! -endfunction - -function! GRCmd(cmd) - :call RCmd("git --no-pager " . a:cmd) -endfunction - -" Highlight a column in csv text. -" :Csv 1 " highlight first column -" :Csv 12 " highlight twelfth column -" :Csv 0 " switch off highlight -function! CSVH(colnr) - if a:colnr > 1 - let n = a:colnr - 1 - execute 'match Keyword /^\([^,]*,\)\{'.n.'}\zs[^,]*/' - execute 'normal! 0'.n.'f,' - elseif a:colnr == 1 - match Keyword /^[^,]*/ - normal! 0 - else - match - endif -endfunction -command! -nargs=1 Csv :call CSVH(<args>) - -" Wipe buffers with no files -function! s:WipeBuffersWithoutFiles() - let bufs=filter(range(1, bufnr('$')), 'bufexists(v:val) && '. - \'empty(getbufvar(v:val, "&buftype")) && '. - \'!filereadable(bufname(v:val))') - if !empty(bufs) - execute 'bwipeout' join(bufs) - endif -endfunction -command! WipeNoFiles call s:WipeBuffersWithoutFiles() - -" - -runtime! config/*.vim diff --git a/dotfiles/.xmonad/xmonad.hs b/dotfiles/.xmonad/xmonad.hs @@ -26,6 +26,7 @@ import XMonad.Hooks.SetWMName import XMonad.Hooks.UrgencyHook import XMonad.Layout.Gaps import XMonad.Layout.Grid +import XMonad.Util.Scratchpad import XMonad.Layout.LayoutModifier import XMonad.Layout.Maximize import XMonad.Layout.MultiToggle @@ -193,14 +194,17 @@ shouldFloat = do name <- appName return (fs && not (shouldntFloat name)) +scratchHook = scratchpadManageHook (W.RationalRect 0.1 0.1 0.6 0.3) +myManageHook = scratchHook <+> (shouldFloat --> doFullFloat) + myConfig theme = let lout = layout theme cfg = def { - terminal = "urxvtc" + terminal = termName , modMask = mod4Mask , layoutHook = lout , startupHook = myStartupHook (Layout lout) - , manageHook = shouldFloat --> doFullFloat -- doesn't show otherwise + , manageHook = myManageHook , normalBorderColor = "#222" , focusedBorderColor = "#BE5046" } @@ -236,6 +240,9 @@ toggleFull theme = sendMessage (Toggle (TabbedFull theme)) toggleMirror = sendMessage (Toggle MIRROR) toggleCenter = sendMessage (Toggle Center) +termName :: String +termName = "urxvtc" + myKeys theme = [ ("M-p", spawn "dmenu_run -fn \"terminus-12\" -p \"run\"") , ("M-a", focusUrgent) @@ -244,6 +251,7 @@ myKeys theme = [ , ("M-c", toggleCenter) , ("M-b", toggleMirror) , ("M-g", toggleGaps) + , ("M-s", scratchpadSpawnActionTerminal termName) -- , ("M-r", toggleFull) , ("M-v", sendKey shiftMask xK_Insert) ] diff --git a/dotfiles/commands b/dotfiles/commands @@ -1,52 +1,57 @@ bt btc txs fuzz-btc-txs cc compile fuzz-compile cd change directory fuzz-cd-dirname +cdpr cd project root echo cd $(project-root) ce compile error fuzz-compile-error cR compile repeat error fuzz-compile-repeat-error cr compile repeat fuzz-compile-repeat cs compile show build echo cat .build-result ecc edit vdirsyncer config echo edit ~/.config/vdirsyncer/config ec edit commands fuzz-edit-scripts +ed edit default.nix echo edit default.nix eFc edit fuzz command fuzz-edit-command eFl edit fuzz command list fuzz-edit-command-list egc edit git config echo edit ~/.gitconfig -elf edit last files fuzz-last-files edit -em edit mimi echo edit ~/.config/mimi/mime.conf -enc edit neomutt config echo edit ~/.config/neomutt/neomuttrc egm edit gemmarks echo edit ~/dotfiles/gemmarks -es email status echo email-status-once -evc edit nvim config echo edit ~/.config/nvim/init.vim +elf edit last files fuzz-last-files edit +eM edit mimi echo edit ~/.config/mimi/mime.conf +em edit mutt config echo edit ~/.config/neomutt/neomuttrc +vim edit vim config echo edit ~/.config/nvim/init.vim ff create file echo fuzz-create-file -jt jump tag fuzz-jump-tag -G gemini echo gemmark gb git branches echo git bvr +G gemini echo gemmark ghi github issues fuzz-gh-issue-list ghp github prf fuzz-gh-pr-list gpm git mlap echo git mlap h run history fuzz-run-hist +jt jump tag fuzz-jump-tag kp khal personal echo pcal -m make fuzz-make nai notmuch archive inbox fuzz-notmuch-archive-inbox nam notmuch am fuzz-notmuch-am nat notmuch archive fuzz-notmuch-archive Nc new command echo make-script ni notmuch inbox fuzz-notmuch-inbox nt notmuch threads fuzz-notmuch-threads +nT email today echo f nt query:today of open file fuzz-open-file olf open last files fuzz-last-files open pc cat project file fuzz-cat-file pf edit project file fuzz-edit-file ps edit project skeletons fuzz-edit-file --dir ~/dotfiles/skeletons rf recent files fuzz-recent-files -sgh search git head fuzz-edit-diff-line HEAD^- sc show command fuzz-show-script -sgd search git diff fuzz-edit-diff-line -sgs search git staged diff fuzz-edit-diff-line --staged +ds docs->stripe fuzzdoc ~/docs/stripe-v72.txt '^type ' +Ssg steamoji service gql fuzzedit schema '^type ' +Ssm steamoji service mutations fuzzedit mutation '^func ' +Ssq steamoji service queries fuzzedit query '^func ' +Sd edit steamoji doc echo edit /home/jb55/projects/steamoji/doc/$(ls -1pt /home/jb55/projects/steamoji/doc | grep -v / | head -n1) sFc show fuzz command fuzz-show-fuzz-command sf search project file funcs fuzz-funcs +sgd search git diff fuzz-edit-diff-line +sgh search git head fuzz-edit-diff-line HEAD^- +sgs search git staged diff fuzz-edit-diff-line --staged sh show history fuzz-show-hist sp search project fuzz-search-files ss search project file fuzz-search-file te todos edit echo edit ~/docs/todo/todo.txt -tj tag jump fuzz-tag-jump z fz echo fz diff --git a/dotfiles/gemmarks b/dotfiles/gemmarks @@ -3,3 +3,5 @@ capcom gemini://gemini.circumlunar.space/capcom drewdevault gemini://drewdevault.com discovery gemini://discovery.geminiprotocol.com search gemini://geminispace.info/ +marginalia-search gemini://marginalia.nu/search +fedwiki gemini://jb55.com:1966 diff --git a/jb55pkgs/default.nix b/jb55pkgs/default.nix @@ -91,8 +91,8 @@ in rec { snap = fetch { repo = "sharefile-snap"; - rev = "1.3"; - sha256 = "0j8j2588z09v7zz1f9d11zw2n0wq70sxy9lvwrw4l5yz75n3cral"; + rev = "7eacc49f1df577a9faaa33a22664d93347ff362d"; + sha256 = "0x5531qyimpah48ijx2bad0mq1gjbpjacymwl3gm08lm0zl0xr09"; }; bcalc = fetch-jb55 { diff --git a/nix-config/environment/default.nix b/nix-config/environment/default.nix @@ -8,13 +8,14 @@ let jb55pkgs = import <jb55pkgs> { inherit pkgs; }; sha256 = "0xd86s2smjvlc7rlb6rkgx2hj3c3sbcz3gs8rf93x69jqdvwb6rr"; }) {}; myPackages = with jb55pkgs; [ + rsslink bcalc btcs csv-delim csv-scripts datefmt extname - kindle-send + #kindle-send mandown ratio samp @@ -29,7 +30,6 @@ let jb55pkgs = import <jb55pkgs> { inherit pkgs; }; minimal-pkgs = with pkgs; [ git-tools - neovim fzf ripgrep ]; @@ -43,16 +43,17 @@ let jb55pkgs = import <jb55pkgs> { inherit pkgs; }; bat bc binutils + cp437 dateutils direnv du-dust - hashcash file fzf git-tools - gnupg gnumake + gnupg groff + hashcash haskellPackages.una htop imagemagick @@ -63,30 +64,45 @@ let jb55pkgs = import <jb55pkgs> { inherit pkgs; }; linuxPackages.bpftrace linuxPackages.perf lsof + mailutils manpages mdcat minisign neovim + nethack network-tools + nix-direnv nodejs opentimestamps-client par parallel patchelf pv - python + python3 ripgrep rsync + scdoc screen shellcheck + universal-ctags unixtools.xxd unzip - universal-ctags weechat wget + xonsh zip zstd ]; in { environment.systemPackages = if extra.is-minimal then minimal-pkgs else mypkgs; + + nix.extraOptions = '' + keep-outputs = true + keep-derivations = true + ''; + + environment.pathsToLink = [ + "/share/nix-direnv" + ]; + } diff --git a/nix-config/environment/desktop/default.nix b/nix-config/environment/desktop/default.nix @@ -29,12 +29,14 @@ let gtk2rc = pkgs.writeText "gtk2rc" '' enableIntro = false; enableFPS = false; enableDFHack = false; - enableTextMode = true; + enableTextMode = false; + theme = "cla"; }; mypkgs = (with pkgs; [ aerc hwi + bitcoin clipmenu colorpicker dmenu @@ -48,6 +50,7 @@ let gtk2rc = pkgs.writeText "gtk2rc" '' getmail # for getmail-gmail-xoauth-tokens gnome3.gnome-calculator gtk-engine-murrine + lagrange lastpass-cli libnotify msmtp @@ -59,7 +62,7 @@ let gtk2rc = pkgs.writeText "gtk2rc" '' pavucontrol pinentry postgresql # psql - python37Packages.trezor + #python37Packages.trezor qalculate-gtk qutebrowser rxvt_unicode-with-plugins @@ -112,6 +115,8 @@ in { VK_ICD_FILENAMES = "/run/opengl-driver/share/vulkan/icd.d/radeon_icd.x86_64.json"; # radv }; + programs.steam.enable = true; + environment.systemPackages = if extra.is-minimal then (with pkgs; [ #steam #steam-run diff --git a/nix-config/machines/monad/default.nix b/nix-config/machines/monad/default.nix @@ -268,16 +268,16 @@ in "f /dev/shm/scream 0660 jb55 qemu-libvirtd -" ]; - systemd.user.services.scream-ivshmem = { - enable = true; - description = "Scream IVSHMEM"; - serviceConfig = { - ExecStart = "${pkgs.scream-receivers}/bin/scream-ivshmem-pulse /dev/shm/scream"; - Restart = "always"; - }; - wantedBy = [ "multi-user.target" ]; - requires = [ "pulseaudio.service" ]; - }; + #systemd.user.services.scream-ivshmem = { + # enable = true; + # description = "Scream IVSHMEM"; + # serviceConfig = { + # ExecStart = "${pkgs.scream-receivers}/bin/scream-ivshmem-pulse /dev/shm/scream"; + # Restart = "always"; + # }; + # wantedBy = [ "multi-user.target" ]; + # requires = [ "pulseaudio.service" ]; + #}; systemd.user.services.btc-ban-aws = { enable = if extra.is-minimal then false else true; diff --git a/nix-config/machines/monad/networking/default.nix b/nix-config/machines/monad/networking/default.nix @@ -29,7 +29,6 @@ let }; ports = { - synergy = 24800; lightning = 9735; lightningt = 9736; lntun = 7878; @@ -64,7 +63,7 @@ in networking.hostId = extra.machine.hostId; #networking.firewall.trustedInterfaces = ["wg0"]; - networking.firewall.allowedTCPPorts = with ports; [ lightning lightningt synergy http ]; + networking.firewall.allowedTCPPorts = with ports; [ lightning lightningt http ]; networking.firewall.allowedUDPPorts = with ports; [ dns wireguard ]; networking.nat.enable = true; diff --git a/nix-config/machines/quiver/default.nix b/nix-config/machines/quiver/default.nix @@ -21,6 +21,40 @@ extra: options thinkpad_acpi enabled=0 ''; + services.teamviewer.enable = true; + + services.synergy.server.enable = true; + services.synergy.server.screenName = "quiver"; + services.synergy.server.autoStart = true; + services.synergy.server.configFile = pkgs.writeText "barrier-cfg" '' + section: screens + monad: + quiver: + mac: + end + section: aliases + monad: + 10.100.0.1 + quiver: + 10.100.0.2 + mac: + 10.100.0.4 + end + section: links + monad: + left = quiver + quiver: + right = monad + left = mac + mac: + right = quiver + end + section: options + keystroke(alt+control+h) = switchInDirection(left) + keystroke(alt+control+l) = switchInDirection(right) + end + ''; + # telepathy is a garbage fire services.telepathy.enable = false; @@ -165,9 +199,16 @@ extra: # https://github.com/nmikhailov/Validity90 # driver not done yet services.fprintd.enable = false; + #services.pleroma.enable = true; + services.tor.enable = true; services.tor.client.enable = true; services.tor.controlPort = 9051; + services.tor.client.socksListenAddress = { + addr = "172.24.0.1"; + port = 9050; + IsolateDestAddr = false; + }; services.autorandr.enable = true; services.acpid.enable = false; diff --git a/nix-config/machines/quiver/networking/default.nix b/nix-config/machines/quiver/networking/default.nix @@ -13,6 +13,20 @@ let ip46tables -A nixos-fw -i ${dev} -p tcp --dport ${toString port} -j nixos-fw-accept ''; + ports = { + synergy = 24800; + wireguard = 51820; + }; + + firewallRules = [ + "nixos-fw -s 10.100.0.1/24 -p tcp --dport ${toString ports.synergy} -j nixos-fw-accept" + "nixos-fw -s 172.24.0.1/24 -p tcp --dport 9050 -j nixos-fw-accept" + ]; + + addRule = rule: "iptables -A ${rule}"; + rmRule = rule: "iptables -D ${rule} || true"; + extraCommands = lib.concatStringsSep "\n" (map addRule firewallRules); + extraStopCommands = lib.concatStringsSep "\n" (map rmRule firewallRules); in { networking.extraHosts = '' @@ -27,6 +41,8 @@ in # Determines the IP address and subnet of the client's end of the tunnel interface. ips = [ "10.100.0.2/28" ]; + listenPort = 51820; + # Path to the private key file. # # Note: The private key can also be included inline via the privateKey option, @@ -41,7 +57,8 @@ in #allowedIPs = [ "0.0.0.0/0" "::/0" ]; allowedIPs = [ "10.100.0.1/32" ]; #endpoint = "127.0.0.1:3333"; - endpoint = "24.84.152.187:51820"; + #endpoint = "24.84.152.187:51820"; + endpoint = "24.84.152.187:53"; persistentKeepalive = 25; } @@ -49,6 +66,7 @@ in publicKey = "BklL4dTL8WK3xnmM899Hr50/UlXaLYhJQWllj2p4ZEg="; allowedIPs = [ "10.100.0.7/32" ]; endpoint = "45.79.91.128:51820"; + persistentKeepalive = 25; } { publicKey = "vIh3IQgP92OhHaC9XBiJVDLlrs3GVcR6hlXaapjTiA0="; @@ -61,6 +79,7 @@ in { publicKey = "Dp8Df75X8Kh9gd33e+CWyyhOvT4mT0X9ToPwBUEBU1k="; # macos allowedIPs = [ "10.100.0.4/32" ]; + endpoint = "192.168.86.24:51820"; # Send keepalives every 25 seconds. Important to keep NAT tables alive. persistentKeepalive = 25; @@ -72,41 +91,9 @@ in networking.wireless.userControlled.enable = false; networking.firewall.enable = true; - networking.firewall.extraCommands = '' - ${lib.concatStringsSep "\n\n" (map openChromecast chromecastIPs)} - - # home network nginx - iptables -A nixos-fw -p tcp -s 192.168.86.0/24 -d 192.168.86.0/24 --dport 80 -j nixos-fw-accept - - # mark tor-related packets - iptables -t mangle -A OUTPUT -m cgroup --cgroup 12 -j MARK --set-mark 12 - - # all tor traffic should never try to route outside our wireguard tunnel to our tor node - iptables -t nat -A POSTROUTING -m cgroup --cgroup 12 -o wg0 -j MASQUERADE - - # create separate routing table - ${ipr} rule add fwmark 12 table 12 - - # add fallback route that blocks traffic, should the VPN go down - ${ipr} route add blackhole default metric 2 table 12 - ''; - - networking.firewall.extraStopCommands = '' - iptables -D nixos-fw -p tcp -s 192.168.86.0/24 -d 192.168.86.0/24 --dport 80 -j nixos-fw-accept || true - - # mark tor-related packets - iptables -t mangle -D OUTPUT -m cgroup --cgroup 12 -j MARK --set-mark 12 || true - - # all tor traffic should never try to route outside our wireguard tunnel to our tor node - iptables -t nat -D POSTROUTING -m cgroup --cgroup 12 -o wg0 -j MASQUERADE || true - - # create separate routing table - ${ipr} rule del fwmark 12 table 12 - - # add fallback route that blocks traffic, should the VPN go down - ${ipr} route del blackhole default metric 2 table 12 - ''; - + networking.firewall.extraCommands = extraCommands; + networking.firewall.extraStopCommands = extraStopCommands; #networking.firewall.allowedTCPPorts = [ 8333 ]; + networking.firewall.allowedUDPPorts = with ports; [ wireguard ]; } diff --git a/nix-config/machines/quiver/timers/default.nix b/nix-config/machines/quiver/timers/default.nix @@ -3,4 +3,18 @@ extra: { imports = [ ]; + + systemd.user.services.myopia-reminder = { + enable = true; + description = "Myopia Reminder"; + + wantedBy = [ "graphical-session.target" ]; + after = [ "graphical-session.target" ]; + + serviceConfig.ExecStart = extra.util.writeBash "myopia-reminder" '' + ${pkgs.libnotify}/bin/notify-send -u critical "👁" + ''; + + startAt = "*:0/20"; # every 20 minutes + }; } diff --git a/nix-config/misc/imap-notifier/default.nix b/nix-config/misc/imap-notifier/default.nix @@ -70,8 +70,9 @@ with extra; { set -e export HOME=/home/jb55 export DATABASEDIR=$HOME/mail/personal - EVAR=/home/jb55/var/notify - LAST_COUNT=$EVAR/last-email-count + + EVAR=/home/jb55/var/notify + LAST_COUNT=$EVAR/last-email-count notify() { local c=$(notmuch --config /home/jb55/.notmuch-config-personal count 'tag:inbox and not tag:filed and not tag:noise') @@ -81,6 +82,7 @@ with extra; { fi echo "$c" > $LAST_COUNT if [ -f ~/var/notify/home ] && [ $c -ne $lc ]; then + echo "$c" > $EVAR/email-notify ${pkgs.libnotify}/bin/notify-send -i email-new "You Got Mail (inbox $c)" fi } diff --git a/nix-config/nixpkgs/config.nix b/nix-config/nixpkgs/config.nix @@ -21,10 +21,6 @@ in { smbdSupport = true; }; - scream-receivers = super.scream-receivers.override { - pulseSupport = true; - }; - # /run/current-system/sw/bin/ls $HOME/.emacs.d/elpa | sed 's/-[[:digit:]].*//g;s/\+$/-plus/g' | sort -u #emacs = super.emacsHead; nur = import (builtins.fetchTarball { @@ -34,15 +30,6 @@ in { inherit pkgs; }; - less = pkgs.lib.overrideDerivation super.less (attrs: { - patches = [ - (super.fetchurl { - url = "https://jb55.com/s/0001-mark-save-lastmarks.patch"; - sha256 = "4974a406ddcdc46c2008b9a828d9eba3a04b8a46ed02ca5e5534b2f09441a709"; - }) - ]; - }); - msmtp = pkgs.lib.overrideDerivation super.msmtp (attrs: { patches = [ (super.fetchurl { @@ -76,23 +63,12 @@ in { wine = super.wineWowPackages.staging; - phonectl = super.python3Packages.callPackage (import (super.fetchFromGitHub { - owner = "jb55"; - repo = "phonectl"; - sha256 = "0wqpwg32qa1rzpw7881r6q2zklxlq1y4qgyyy742pihfh99rkcmj"; - rev = "de0f37a20d16a32a73f9267860302357b2df0c20"; - })) {}; - - notmuch = pkgs.lib.overrideDerivation super.notmuch (attrs: { - src = pkgs.fetchFromGitHub { - owner = "jb55"; - repo = "notmuch"; - rev = "f0f99973ad9d4e932b34cc76a5d7c6629079575a"; - sha256 = "0n89q4vlq0yhn6dqjjb7sva54cvg62hcj1yxryvs5jai5n5gl493"; - }; - - doCheck = false; - }); + #phonectl = super.python3Packages.callPackage (import (super.fetchFromGitHub { + # owner = "jb55"; + # repo = "phonectl"; + # sha256 = "0wqpwg32qa1rzpw7881r6q2zklxlq1y4qgyyy742pihfh99rkcmj"; + # rev = "de0f37a20d16a32a73f9267860302357b2df0c20"; + #})) {}; # wirelesstools = # let