citadel

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

commit 8495826147863378ba21a029fb4e04f48f7a549a
parent 06489c519a5d4ddac03abf5bd8c471b6d3d371fa
Author: William Casarin <jb55@jb55.com>
Date:   Tue, 18 Feb 2025 12:09:37 -0800

many updates

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mbin/bcli | 2+-
Mbin/btc-balance | 16++++++++++++----
Mbin/btc-coins | 7+++----
Mbin/btc-txs | 2+-
Mbin/btc-txs-raw | 2+-
Mbin/connect-bose | 3+--
Mbin/edit | 2+-
Mbin/file-jump | 2+-
Mbin/fuzz-compile | 7+++----
Mbin/fuzz-compile-error | 4++--
Mbin/fuzz-compile-repeat | 2+-
Mbin/fuzz-edit-file | 2+-
Mbin/gh-clone | 13+++++++------
Mbin/mail-prpatch-insert | 18+++++++++---------
Mbin/makex | 2+-
Mbin/pandoc-nice | 3++-
Mdotfiles/.Xresources | 5++++-
Mdotfiles/.bash_aliases | 2+-
Mdotfiles/.bashrc | 10++++++----
Mdotfiles/.config/neomutt/neomuttrc | 11++++++++---
Mdotfiles/.config/nvim/init.vim | 37+++++++++++++++++++++++++++++++++----
Mdotfiles/.config/qutebrowser/autoconfig.yml | 10++++++++--
Mdotfiles/.config/qutebrowser/config.py | 19++++++++++++-------
Mdotfiles/.config/qutebrowser/quickmarks | 2++
Mdotfiles/.gitconfig | 16+++++++++-------
Mdotfiles/.notmuch-config | 2++
Mdotfiles/.tmux.conf | 2+-
Mdotfiles/.vim/.vimrc | 67++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
Mdotfiles/.xbindkeysrc | 15+++++++++++++++
Mdotfiles/.xmonad/xmonad.hs | 40++++++++++++++++++++++++++++++++++------
Mdotfiles/commands | 82+++++++++++++++++++++++++++++++++++++++++--------------------------------------
Mdotfiles/skeletons/nix-rust/shell.nix | 2+-
Mnix-config/configuration.nix | 19+++++++++++++++++--
Mnix-config/environment/default.nix | 35+++++++++++++++++++----------------
Mnix-config/environment/desktop/default.nix | 35++++++++++++++---------------------
Mnix-config/fonts/default.nix | 10++++++++++
Mnix-config/hardware/desktop/default.nix | 22+++++++++++++++++++---
Mnix-config/machines/archer/default.nix | 2--
Mnix-config/machines/charon/networking/default.nix | 3++-
Mnix-config/machines/monad/bitcoin/default.nix | 7+++++--
Mnix-config/machines/monad/bitcoin/walletemail.nix | 2+-
Mnix-config/machines/monad/config/default.nix | 2++
Mnix-config/machines/monad/default.nix | 68++++++++++++++++++++++++++++++++++++++++++++------------------------
Mnix-config/machines/monad/hardware/default.nix | 19++++++++++++-------
Mnix-config/machines/monad/networking/default.nix | 49+++++++++++++++++++++++++++++++------------------
Anix-config/machines/monad/rocksmith.nix | 37+++++++++++++++++++++++++++++++++++++
Mnix-config/misc/dnsmasq-adblock.nix | 3+++
Mnix-config/nixpkgs/config.nix | 12++++++++++--
Mnix-config/services/desktop/default.nix | 2+-
49 files changed, 513 insertions(+), 223 deletions(-)

diff --git a/bin/bcli b/bin/bcli @@ -1,7 +1,7 @@ #!/bin/sh if [ $(hostname) == "monad" ] then - exec bitcoin-cli -rpcuser=rpcuser -rpcpassword=rpcpass -datadir=/zbig/bitcoin "$@" + exec bitcoin-cli -rpcuser=rpcuser -rpcpassword=rpcpass -datadir=/titan/bitcoin "$@" else ssh monad bcli "$@" fi diff --git a/bin/btc-balance b/bin/btc-balance @@ -9,11 +9,19 @@ do bcli -rpcwallet="$wallet" getbalance done -summary=$(lcli summary) -if [ -n "$summary" ] +channel_msat=$(lcli listfunds | jq '.channels[].our_amount_msat' | paste -sd+ | bc) +onchain_msat=$(lcli listfunds | jq '.outputs[].amount_msat' | paste -sd+ | bc) + +if [ -n "$channel_msat" ] +then + echo -n "cln-channels " + printf '%s msat to btc\n' "$channel_msat" | bcalc -n +fi + +if [ -n "$onchain_msat" ] then - echo -n "cln-availout " - <<<"$summary" grep avail_out | cut -d= -f2 | cut -d" " -f1 | xargs printf '%s to btc\n' | bcalc -n + echo -n "cln-onchain " + printf '%s msat to btc\n' "$onchain_msat" | bcalc -n fi #if [ -n "$1" ]; then diff --git a/bin/btc-coins b/bin/btc-coins @@ -4,7 +4,6 @@ WALLETS=${WALLETS:-$(bcli listwallets | jq -r '.[]' | paste -sd" " )} (for wallet in $WALLETS do - bcli -rpcwallet="$wallet" "$@" listaddressgroupings \ - | jq -r -c ".[][] | select(.[1] != 0) | [\"$wallet\"] + . | @tsv" -done) \ - | column -t -s $'\t' + #bcli -rpcwallet="$wallet" "$@" listaddressgroupings | jq -r -c ".[][] | select(.[1] != 0) | [\"$wallet\"] + . | @tsv" + bcli -rpcwallet="$wallet" listunspent | jq -rc ".[] | [\"$wallet\",.amount,.address,.confirmations] | @tsv" +done) diff --git a/bin/btc-txs b/bin/btc-txs @@ -4,5 +4,5 @@ btc-txs-raw | tac | datefmt --after $(date +%s -d 2009-01-01) --before $(date +%s -d 2030-01-01) '%F' | ct | -zebra | +zebra "$@" | less -S diff --git a/bin/btc-txs-raw b/bin/btc-txs-raw @@ -4,7 +4,7 @@ WALLETS=${WALLETS:-$(bcli listwallets | jq -r '.[]' | paste -sd" " )} (for wallet in $WALLETS do - bcli -rpcwallet="$wallet" "$@" listtransactions '*' 2000 \ + bcli -rpcwallet="$wallet" "$@" listtransactions '*' 10000 \ | jq -rc '.[] | {wallet: "'$wallet'", label: .label, address: .address, category: .category, amount: .amount, blocktime: .blocktime, confirmations: .confirmations, txid: .txid, vout: .vout}' done) \ | jq -src 'sort_by(.blocktime) | .[] | [.wallet,.label,.address,.category,.amount,.blocktime,.confirmations,.txid,.vout] | @tsv' diff --git a/bin/connect-bose b/bin/connect-bose @@ -1,2 +1,2 @@ #!/usr/bin/env bash -bluetoothctl <<<"connect 00:0C:8A:70:43:60"- \ No newline at end of file +bluetoothctl <<<"connect 00:0C:8A:70:43:60" diff --git a/bin/edit b/bin/edit @@ -1,6 +1,6 @@ #!/usr/bin/env bash -exec nvim "$@" +exec vim "$@" #if [ -t 0 ]; then #else diff --git a/bin/file-jump b/bin/file-jump @@ -2,5 +2,5 @@ set -eou pipefail -sed -E -n "s,[[:space:]]*([^: ]+):([0-9]+).*,\x1Eedit \"\\1\" +\\2,p" | +sed -E -n "s,[[:space:]]*([^: ]+):([0-9]+).*,\x1Eedit -c \":cfile build.log | copen | wincmd k\" \"\\1\" +\\2,p" | cut -d $'\x1E' -f2- diff --git a/bin/fuzz-compile b/bin/fuzz-compile @@ -13,13 +13,12 @@ then cmd="npm run $target" elif [ -f Cargo.toml ] then - target=$(printf "check\nbuild\ntest\n" | fuzzer "$@") - cmd="cargo $target --color=always 2>&1| sed -E '/^.*(warning|error).*:/N;s/\n//;s/-->//g'" + target=$(printf "check\nbuild\ntest\nclippy\nlint\n" | fuzzer "$@") + cmd="cargo $target" else target=$(fuzz-make "$@") cmd="make -j $target" fi -fullcmd="$cmd 2>&1| tee $tmp; mv $tmp .build-result" - +fullcmd="$cmd 2>&1| tee $tmp; mv $tmp build.log" <<<"$fullcmd" tee .buildcmd diff --git a/bin/fuzz-compile-error b/bin/fuzz-compile-error @@ -2,7 +2,7 @@ set -eou pipefail -if [ ! -f .build-result ]; then +if [ ! -f build.log ]; then printf "no build result found\n" >&2 exit 1 fi @@ -11,6 +11,6 @@ fi PLANG=rust ERR_OPTS="--exit-0 --tac --ansi --preview 'build-preview {}' --preview-window=top" -<.build-result grep -E '[[:space:]]*[^: ]+:[0-9]+.*' | +<build.log grep -E '[[:space:]]*[^: ]+:[0-9]+.*' | env FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS $ERR_OPTS" fuzzer "$@" | file-jump diff --git a/bin/fuzz-compile-repeat b/bin/fuzz-compile-repeat @@ -1,2 +1,2 @@ #!/usr/bin/env bash -cat .buildcmd +cat .buildcmd | less diff --git a/bin/fuzz-edit-file b/bin/fuzz-edit-file @@ -5,6 +5,6 @@ if [ "$1" = "--dir" ]; then cd "$1" shift fi -file=$(readlink -f $(rg --files | fuzzer "$@")) +file=$(readlink -f "$(rg --files | fuzzer "$@")") echo $EDITOR \"$file\" diff --git a/bin/gh-clone b/bin/gh-clone @@ -32,15 +32,16 @@ dir="$dest/$repo" [ -d "$dir" ] && already_exists "$owner/$repo" "$dir" mkdir -p "$dest" + cd "$dest" + git clone "$@" "gh:$owner/$repo" -git config \ - --file="$dir/.git/config" \ - --add remote.origin.fetch '+refs/pull/*/head:refs/pull/origin/*' +cd "$dir" + +git remote rename origin github git config \ - --file="$dir/.git/config" \ - --add remote.origin.fetch '+refs/pull/*/merge:refs/merge/origin/*' + --add remote.github.fetch '+refs/pull/*/head:refs/remotes/pr/*' -printf "%s\n" "$dest/$repo" +printf "%s\n" "$dir" diff --git a/bin/mail-prpatch-insert b/bin/mail-prpatch-insert @@ -41,16 +41,16 @@ threadid=$msgid for file in "$PATCHES/"* do # mailsplit introduces linebreaks from some reason - awk ' - /^Subject:/ { subj = 1; printf "%s", $0; next } - subj && !/^$/ { printf " %s", $0; next } - /^$/ && subj { subj = 0; print ""; next } - { print } - ' < "$file" > "$file".2 - mv "$file".2 "$file" + #awk ' + # /^Subject:/ { subj = 1; printf "%s", $0; next } + # subj && !/^$/ { printf " %s", $0; next } + # /^$/ && subj { subj = 0; print ""; next } + # { print } + #' < "$file" > "$file".2 + #mv "$file".2 "$file" if [ -n "$replyto" ]; then - sed -i"" "1 a Cc: $replyto" "$file" + sed -i"" "1 a Bcc: $replyto" "$file" fi if [ -n "$prlink" ]; then @@ -72,7 +72,7 @@ do sed -i"" "1 a In-Reply-To: $threadid" "$file" sed -i"" "1 a References: $threadid" "$file" - notmuch insert +inbox < "$file" + notmuch insert +work +inbox < "$file" msgid=$(new_msgid "$file") done diff --git a/bin/makex b/bin/makex @@ -1,2 +1,2 @@ #!/usr/bin/env bash -exec chmod +x "$1" +chmod +x "$1" diff --git a/bin/pandoc-nice b/bin/pandoc-nice @@ -1,7 +1,8 @@ #!/usr/bin/env bash pandoc \ --pdf-engine=xelatex \ - --metadata=fontfamily:libertine \ -V geometry:margin=1.2in \ --variable urlcolor=cyan \ "$@" + +#--metadata=fontfamily:libertine \ diff --git a/dotfiles/.Xresources b/dotfiles/.Xresources @@ -30,8 +30,11 @@ URxvt.resize-font.bigger: M-0 !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=14:hinting=true +!URxvt*font: xft:Inconsolata:size=18:hinting=true !urxvt.font: xft:terminus:antialias=false:pixelsize=16 +!urxvt.font: xft:cozette:antialias=false:pixelsize=16 +!URxvt*font: xft:Cozette:style=Medium !xft:Inconsolata:size=18:antialias=true;hinting=true ! diff --git a/dotfiles/.bash_aliases b/dotfiles/.bash_aliases @@ -74,7 +74,7 @@ function run_fuzzer() { } alias C="pcal list" -alias m="neomutt" +#alias m="neomutt" alias mq="msmtp-queue" alias s="general-status" alias t="todo.sh" diff --git a/dotfiles/.bashrc b/dotfiles/.bashrc @@ -22,15 +22,16 @@ IN_NIX="" if [ -n "$IN_NIX_SHELL" ]; then IN_NIX="-nix" fi -export PS1='$(printf "\x01\033[30;1m\x02%3.*s\x01\033[0m\x02 %s%s> \x01\033[33m\x02" $? $? $HOST $IN_NIX)' -export PS0='\033[0m' +#export PS1='$(printf "\x01\033[30;1m\x02%3.*s\x01\033[0m\x02 %s%s> \x01\033[33m\x02" $? $? $HOST $IN_NIX)' +export PS1='\[\033[30;1m\]$(printf "%3.*s" $? $?)\[\033[0m\] \h\[\033[33m\]> \[\033[0m\]' +#export PS0='\033[0m' #export PS1='$(printf "\x01\033[30;1m\x02%3.*s\x01\033[0m\x02> " $? $?)' # don't put duplicate lines in the history. See bash(1) for more options #export HISTCONTROL=ignoredups # ... and ignore same sucessive entries. -export HISTCONTROL=ignoreboth:erasedups +export HISTCONTROL=erasedups export HISTSIZE=50000 # check the window size after each command and, if necessary, @@ -95,6 +96,7 @@ export GOPATH=$HOME/dev/gocode export PATH=$HOME/bin:$PATH export PATH=$HOME/.local/bin:$PATH export PATH=$HOME/.npm/bin:$PATH +export PATH=$HOME/.cargo/bin:$PATH export PATH=$GOPATH/bin:$PATH md () { @@ -130,6 +132,7 @@ alias jcu="journalctl --user -u" alias jsonpp="python -mjson.tool" alias ls="ls --color" alias m="neomutt" +alias mw="neomutt -f work" alias mq="msmtp-queue" alias mt="f nt query:today" alias myipaddress=myip @@ -148,7 +151,6 @@ alias tmuxa="tmux a -d -t " alias tmux="tmux -2" alias t="todo.sh" alias u="cd .." -alias vim=nvim alias vless="/usr/share/vim/vim72/macros/less.sh" alias vnc_once="x11vnc -safer -nopw -once -display :0" alias wanip=myip diff --git a/dotfiles/.config/neomutt/neomuttrc b/dotfiles/.config/neomutt/neomuttrc @@ -32,17 +32,19 @@ virtual-mailboxes \ "patches" "notmuch://?query=query:patches" \ "today" "notmuch://?query=date:today" \ "damus-prs" "notmuch://?query=query:damusp" \ - "damus-issues" "notmuch://?query=query:damusi" + "damus-issues" "notmuch://?query=query:damusi" \ + "work" "notmuch://?query=query:work" \ + "notwork" "notmuch://?query=query:notwork" macro index,pager a "<modify-labels>-unread -inbox<enter>" macro index,pager i "<modify-labels>+inbox<enter>" macro index,pager F "<modify-labels>+filed<enter>" "File message" macro index,pager + "<modify-labels>+" -macro index,pager S "<modify-labels>+spam -unread -inbox<enter>" macro index C "<collapse-all>" "Collapse all threads" macro index c "<collapse-thread>" "Collapse thread" macro index T "<tag-thread>" "Tag thread" macro index \\\\ "<vfolder-from-query>" "Search mailbox" +macro index = "<mark-message>z<enter><change-folder>^<enter>'z" macro pager p "|delta --paging always<enter>" macro pager d "<next-page>" macro pager u "<previous-page>" @@ -50,7 +52,7 @@ macro pager u "<previous-page>" macro pager t "|collapse|less<enter>" #macro attach h "|w3m -dump -T text/html | less<enter>" "View text/html with w3m" -#macro pager P "|grep patch$ | xargs curl -sL | delta --paging always<enter>" +macro pager O "|grep patch$ | xargs curl -sL | delta --paging always<enter>" macro pager P ":set pipe_decode=no<enter> | mail-prpatch | delta --paging always" macro pager G ":set pipe_decode=no<enter> | mail-prpatch-insert" @@ -78,3 +80,6 @@ color header brightcyan default '^Subject:' auto_view text/html alternative_order text/plain text/html source ~/.mail_aliases + +ignore * # Ignore all headers +unignore from to subject date cc bcc # Unignore specific headers diff --git a/dotfiles/.config/nvim/init.vim b/dotfiles/.config/nvim/init.vim @@ -9,9 +9,9 @@ set colorcolumn=80 set nowrap set hidden set rnu nu -set wrap +"set wrap -hi ColorColumn ctermbg=237 +"hi ColorColumn ctermbg=237 "hi ColorColumn ctermbg=254 "hi StatusLine ctermbg=254 @@ -30,6 +30,8 @@ nmap <C-x> :x<CR> nmap <C-s> ^D nmap <C-n> :tn<CR> nmap <C-p> :tp<CR> +nmap <C-N> :cn<CR> +nmap <C-P> :cp<CR> " autoparens "ino " ""<left> @@ -53,9 +55,28 @@ 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 -autocmd FileType rust autocmd BufWritePre <buffer> execute "normal! mz:mkview\<esc>:%!fmtsafe rustfmt\<esc>:loadview\<esc>`z" + +augroup Rust + autocmd! + "autocmd FileType rust autocmd BufWritePre <buffer> execute "normal! mz:mkview\<esc>:%!fmtsafe rustfmt\<esc>:loadview\<esc>`z" + "autocmd FileType rust nnoremap <buffer> <leader>f :mkview<CR>:%!fmtsafe rustfmt<CR>:loadview<CR> + "autocmd FileType rust nnoremap <buffer> <leader>f :execute 'mkview | %!fmtsafe rustfmt | loadview'<CR> + "autocmd FileType rust nnoremap <buffer> <leader>f :%!fmtsafe rustfmt<CR> + autocmd FileType rust nnoremap <buffer> <leader>f :call RustFormat()<CR> + autocmd FileType rust CompilerSet errorformat= + \%-G,% + \%-Gerror:\ aborting\ %.%#,% + \%-Gerror:\ Could\ not\ compile\ %.%#,% + \%Eerror:\ %m,% + \%Eerror[E%n]:\ %m,% + \%Wwarning:\ %m,% + \%Inote:\ %m,% + \%C\ %#-->\ %f:%l:%c,% + \%E\ \ left:%m,%C\ right:%m\ %f:%l:%c,%Z +augroup END + "autocmd FileType javascript autocmd BufWritePre <buffer> execute "normal! mz:mkview\<esc>:%!fmtsafe jsfmt\<esc>:loadview\<esc>`z" -"autocmd BufEnter,BufNew *.js set sw=2 ts=2 expandtab +autocmd BufEnter,BufNew *.js set sw=2 ts=2 expandtab "autocmd filetype html set sw=2 ts=2 expandtab @@ -64,7 +85,15 @@ autocmd BufEnter,BufNew *.gmi set wrap linebreak au BufWritePost,FileWritePost ~/.Xdefaults,~/.Xresources silent! !xrdb -load % >/dev/null 2>&1 +" Automatically move the cursor to the last editing position in a file when you open it, provided that position is valid. if has("autocmd") au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") \| exe "normal! g'\"" | endif endif + +function! RustFormat() + let l:view = winsaveview() + silent! mkview + silent! %!fmtsafe rustfmt + call winrestview(l:view) +endfunction diff --git a/dotfiles/.config/qutebrowser/autoconfig.yml b/dotfiles/.config/qutebrowser/autoconfig.yml @@ -6,5 +6,11 @@ config_version: 2 settings: - content.javascript.clipboard: - global: access + content.media.audio_capture: + https://meet.jit.si: true + content.media.audio_video_capture: + https://meet.jit.si: true + content.media.video_capture: + https://meet.jit.si: true + content.notifications.enabled: + https://ditto.pub: false diff --git a/dotfiles/.config/qutebrowser/config.py b/dotfiles/.config/qutebrowser/config.py @@ -1,5 +1,3 @@ -# Autogenerated config.py -# Documentation: # qute://help/configuring.html # qute://help/settings.html import socket @@ -25,11 +23,16 @@ config.set('content.javascript.enabled', True, 'file://*') # Type: Bool config.set('content.javascript.enabled', True, 'chrome://*/*') +# Disable third-party cookies. Breaks gmail apparently but who cares. +config.set('content.cookies.accept', 'no-3rdparty') + # Enable JavaScript. # Type: Bool config.set('content.javascript.enabled', True, 'qute://*/*') -config.set('fonts.default_family', 'terminus') +config.set('content.javascript.clipboard', 'access') + +#config.set('fonts.default_family', 'terminus') if hostname == 'monad': config.set('zoom.default', 125) @@ -89,11 +92,12 @@ config.bind('Do', 'download-open') config.set('downloads.position', 'bottom') config.set('tabs.select_on_remove', 'last-used') +config.set('tabs.mousewheel_switching', False) config.set('url.default_page', 'about:blank') #config.set('colors.webpage.darkmode.enabled', True) -#config.set('colors.webpage.preferred_color_scheme', 'light') -config.set('colors.webpage.preferred_color_scheme', 'dark') +config.set('colors.webpage.preferred_color_scheme', 'light') +#config.set('colors.webpage.preferred_color_scheme', 'dark') config.set('url.searchengines', { @@ -102,6 +106,7 @@ config.set('url.searchengines', { 'star': 'https://github.com/stars?utf8=%E2%9C%93&q={}', 'so': 'https://google.com/search?q=site:stackoverflow.com {}', 'gl': 'http://www.google.com/search?q={}&btnI=Im+Feeling+Lucky', + 'nip': 'https://github.com/nostr-protocol/nips/blob/master/{}.md', 'ghi': 'https://github.com/{}/issues', 'wa': 'http://www.wolframalpha.com/input/?i={}', 'ha': 'https://google.com/search?q=site:hackage.haskell.org {}', @@ -122,7 +127,7 @@ config.set('url.searchengines', { 'hoogle': 'http://www.haskell.org/hoogle/?hoogle={}', 'github': 'http://github.com/search?q={}', 'r': 'https://old.reddit.com/r/{}', - 'a': 'http://blockstream.info/address/{}', + 'a': 'http://mempool.space/address/{}', 'bgg': 'http://www.boardgamegeek.com/metasearch.php?searchtype=game&search={}', 'pgp': 'http://pgp.mit.edu/pks/lookup?search={}&op=index', 'gh': 'https://github.com/{}', @@ -131,7 +136,7 @@ config.set('url.searchengines', { 'crate': 'https://crates.io/crates/{}', 'repo': 'http://npmrepo.com/{}', 'ec': 'http://package.elm-lang.org/packages/elm-lang/{}/latest', - 'tx': 'https://blockstream.info/tx/{}' + 'tx': 'https://mempool.space/tx/{}' }) diff --git a/dotfiles/.config/qutebrowser/quickmarks b/dotfiles/.config/qutebrowser/quickmarks @@ -1,3 +1,4 @@ +standup https://meet.jit.si/damusstandupandnips activitypub-vocab https://www.w3.org/TR/activitystreams-vocabulary/ bitcoin-ledger https://www.reddit.com/r/Bitcoin/comments/155gw5/heres_how_you_use_ledger_to_account_for_bitcoin/ bitcoinhackers https://bitcoinhackers.org/web/getting-started @@ -27,3 +28,4 @@ scihub https://sci-hub.se/ twitter https://tweetdeck.twitter.com/ wasm-instantiation https://webassembly.github.io/spec/core/exec/modules.html#exec-instantiation topology-lectures https://www.youtube.com/playlist?list=PLRlVmXqzHjUQHEx63ZFxV-0Ortgf-rpJo +ermin https://www.google.com/search?q=quantum%20computer%20science diff --git a/dotfiles/.gitconfig b/dotfiles/.gitconfig @@ -1,7 +1,7 @@ [user] name = William Casarin email = jb55@jb55.com - signingkey = 0x90EEB2149F6689622EFF595FA13C2E3632EA34D7! + signingkey = 0x90EEB2149F6689622EFF595FA13C2E3632EA34D7! [color] diff = auto status = auto @@ -9,7 +9,7 @@ abbrev = 12 excludesfile = /Users/jb55/.gitignore_global editor = edit - pager = delta --paging=always + pager = delta --dark --paging=always --navigate [sendemail] smtpServer=/home/jb55/bin/sendmail ccCmd = git-contacts @@ -90,9 +90,9 @@ autosquash = true [pretty] fixes = Fixes: %h (\"%s\") -[diff] - colorMoved = dimmed-zebra - colorMovedWs = allow-indentation-change +#[diff] + #colorMoved = dimmed-zebra + #colorMovedWs = allow-indentation-change [push] default = simple [rerere] @@ -102,7 +102,6 @@ program = /home/jb55/bin/ots-git [magit] hideCampaign = true -[nostr] [github] user = jb55 [grep] @@ -120,7 +119,7 @@ [diff] tool = difftastic [nostr] - relays = wss://relay.damus.io wss://nos.lol wss://nostr.wine + relays = wss://relay.damus.io wss://nostr.mom wss://nos.lol wss://nostr.wine ws://localhost:8080 [filter "lfs"] clean = git-lfs clean -- %f smudge = git-lfs smudge -- %f @@ -128,3 +127,6 @@ required = true [commit] template = ~/.git-template +[maintenance] + repo = /home/jb55/nixpkgs + repo = /home/jb55/dev/linux diff --git a/dotfiles/.notmuch-config b/dotfiles/.notmuch-config @@ -116,3 +116,5 @@ notmuch=tag:notmuch and tag:inbox patches=subject:PATCH and tag:inbox damusp=(subject:PR or subject:PATCH) and subject:damus and tag:inbox damusi=subject:Issue and subject:damus-io and tag:inbox +work=tag:work and tag:inbox +notwork=not tag:work and tag:inbox and not tag:filed diff --git a/dotfiles/.tmux.conf b/dotfiles/.tmux.conf @@ -42,7 +42,7 @@ unbind j unbind k bind j select-pane -D bind C-j select-pane -D -bind C-k select-pane -U +#bind C-k select-pane -U bind k select-pane -U bind C-h select-pane -L bind h select-pane -L diff --git a/dotfiles/.vim/.vimrc b/dotfiles/.vim/.vimrc @@ -1,6 +1,11 @@ +execute pathogen#infect() +syntax on +filetype plugin indent on + inoremap <Esc> <Nop> inoremap <special> fd <Esc> +set backspace=indent,eol,start set tabstop=8 set shiftwidth=8 set ai @@ -8,6 +13,8 @@ set hlsearch set colorcolumn=80 set nowrap set hidden +set wrap +set rnu nu hi ColorColumn ctermbg=8 @@ -20,19 +27,65 @@ set clipboard=unnamed let mapleader = "\\" let maplocalleader = "\\" nmap <Leader>xda ma:%s/\s\+$//g<CR>`a +nmap <Leader>f ma:%! + +nmap <Leader>co :cfile build.log<CR>:copen<CR>:wincmd k<CR> +nmap <Leader>cl :close<CR>:q<CR> +nmap <Leader>cx :close<CR>:x<CR> +nmap <Leader>cm :!make >& build.log<CR>:cfile build.log<CR>:copen<CR>:wincmd k<CR> +nmap <Leader>cr :!bash .buildcmd >& build.log<CR>:cfile build.log<CR>:copen<CR>:wincmd k<CR> +nmap <Leader>ct :!cargo test >& build.log<CR>:cfile build.log<CR>:copen<CR>:wincmd k<CR> + +nmap ]t :tn<CR> +nmap [t :tp<CR> + +" Custom key binding for :cn (next quickfix) with window adjustments +nnoremap <silent> <C-n> :cn<CR>:wincmd j<CR>zt:wincmd k<CR> -nmap <C-q> :q<CR> -nmap <C-x> :x<CR> -nmap <C-s> ^D -nmap <C-n> :tn<CR> -nmap <C-p> :tp<CR> +" Optional: Custom key binding for :cp (previous quickfix) with window adjustments +nnoremap <silent> <C-p> :cp<CR>:wincmd j<CR>zt:wincmd k<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 html set sw=2 ts=2 expandtab +"autocmd FileType rust autocmd BufWritePre <buffer> execute "normal! mz:mkview\<esc>:%!fmtsafe rustfmt\<esc>:loadview\<esc>`z" +"autocmd FileType rust nnoremap <buffer> <leader>f :mkview<CR>:%!fmtsafe rustfmt<CR>:loadview<CR> +autocmd FileType rust setlocal tags=./rusty-tags.vi;/ +autocmd FileType rust nnoremap <buffer> <leader>f :call RustFormat()<CR> +"autocmd VimEnter *.rs cgetfile build.log +"autocmd QuickFixCmdPost [^l]* nested cwindow +autocmd filetype js set sw=2 ts=2 expandtab autocmd BufEnter,BufNew *.nix set sw=2 ts=2 expandtab autocmd BufEnter,BufNew *.gmi set wrap linebreak +autocmd QuickFixCmdPost * if &buftype == 'quickfix' | + \ execute 'wincmd j' | execute 'normal! zt' | execute 'wincmd k' | + \ endif + +" Automatically scroll the window so the current error is at the top au BufWritePost,FileWritePost ~/.Xdefaults,~/.Xresources silent! !xrdb -load % >/dev/null 2>&1 + +" Automatically move the cursor to the last editing position in a file when you open it, provided that position is valid. +if has("autocmd") + au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") + \| exe "normal! g'\"" | endif +endif + +function! RustFormat() + let l:view = winsaveview() + silent! mkview + silent! %!fmtsafe rustfmt + call winrestview(l:view) +endfunction diff --git a/dotfiles/.xbindkeysrc b/dotfiles/.xbindkeysrc @@ -16,6 +16,10 @@ "xbacklight -dec 5" XF86MonBrightnessDown +"playerctl play-pause" + m:0x0 + c:208 + XF86AudioPlay + "toggle-mute" XF86AudioMute @@ -25,3 +29,14 @@ "snap" Control + Print +"karam" + m:0x0 + c:74 + F8 + +"fletch" + m:0x0 + c:75 + F9 + +"fletch-pagedown" + m:0x0 + c:76 + F10 diff --git a/dotfiles/.xmonad/xmonad.hs b/dotfiles/.xmonad/xmonad.hs @@ -12,6 +12,7 @@ import Data.List --import Data.Default (def) import Control.Monad (when) import System.IO.Unsafe (unsafePerformIO) +import XMonad.Actions.UpdatePointer import System.Posix.Files (readSymbolicLink) import System.Posix.Signals (installHandler, sigUSR1, Handler(CatchOnce)) import System.FilePath.Posix (takeBaseName) @@ -20,13 +21,14 @@ import XMonad.Actions.CycleWS import XMonad.Actions.SpawnOn (shellPromptHere, manageSpawn) import XMonad.Actions.UpdatePointer import XMonad.Hooks.EwmhDesktops (ewmh) +--import XMonad.Hooks.EwmhDesktops (ewmhFullscreen) import XMonad.Hooks.ManageDocks import XMonad.Hooks.ManageHelpers import XMonad.Hooks.SetWMName import XMonad.Hooks.UrgencyHook import XMonad.Layout.Gaps import XMonad.Layout.Grid -import XMonad.Util.Scratchpad +--import XMonad.Util.Scratchpad import XMonad.Layout.LayoutModifier import XMonad.Layout.Maximize import XMonad.Layout.MultiToggle @@ -35,7 +37,8 @@ import XMonad.Layout.NoBorders import XMonad.Layout.ResizableTile import XMonad.Layout.ResizeScreen import XMonad.Layout.Spacing -import XMonad.Layout.Spiral as S +--import XMonad.Layout.Spiral as S +import XMonad.Layout.Dwindle as D import XMonad.Layout.Tabbed import XMonad.Layout.ToggleLayouts (ToggleLayout(ToggleLayout)) import XMonad.Prompt @@ -49,6 +52,20 @@ import XMonad.Util.Image import qualified XMonad.Layout.HintedTile as HT import qualified XMonad.StackSet as W +import qualified Data.IORef as IORef + +trackMousePosition :: IORef.IORef (Int, Int) -> X () +trackMousePosition posRef = withDisplay $ \dpy -> do + rootw <- asks theRoot + (_, _, _, x, y, _, _, _) <- io $ queryPointer dpy rootw + io $ IORef.writeIORef posRef (fi x, fi y) + +moveToLastPosition :: IORef.IORef (Int, Int) -> X () +moveToLastPosition posRef = do + (x, y) <- io $ IORef.readIORef posRef + withDisplay $ \dpy -> do + rootw <- asks theRoot + io $ warpPointer dpy none rootw 0 0 0 0 (fi x) (fi y) data LibNotifyUrgencyHook = LibNotifyUrgencyHook deriving (Read, Show) @@ -152,7 +169,11 @@ baseLayout = let tall = ResizableTall 1 (3/100) (1/2) [] in - Mirror tall ||| S.spiral (4/3) --S.spiralWithDir S.South S.CW (4/3) + --D.Dwindle D.R D.CW 1.5 1.1 ||| + D.Squeeze D.R 1.38 1.1 + ||| D.Spiral D.R D.CW 0.8 1.1 + --S.spiral (4/3) ||| + --Mirror tall --S.spiralWithDir S.South S.CW (4/3) layout theme = smartBorders @@ -194,8 +215,13 @@ shouldFloat = do name <- appName return (fs && not (shouldntFloat name)) -scratchHook = scratchpadManageHook (W.RationalRect 0.1 0.1 0.6 0.6) -myManageHook = scratchHook <+> (shouldFloat --> doFullFloat) +--scratchHook = scratchpadManageHook (W.RationalRect 0.1 0.1 0.6 0.6) +--myManageHook = scratchHook <+> (shouldFloat --> doFullFloat) +myManageHook = composeAll [ + shouldFloat --> doFullFloat + , className =? "Steam" --> doFloat + , className =? "steam" --> doFullFloat + ] myConfig theme = let lout = layout theme @@ -203,6 +229,7 @@ myConfig theme = terminal = termName , modMask = mod4Mask , layoutHook = lout + , logHook = updatePointer (0.5, 0.5) (0, 0) , startupHook = myStartupHook (Layout lout) , manageHook = myManageHook , normalBorderColor = "#222" @@ -251,13 +278,14 @@ myKeys theme = [ , ("M-c", toggleCenter) , ("M-b", toggleMirror) , ("M-g", toggleGaps) - , ("M-s", scratchpadSpawnActionTerminal termName) + --, ("M-s", scratchpadSpawnActionTerminal termName) -- , ("M-r", toggleFull) , ("M-v", sendKey shiftMask xK_Insert) ] + sendRestart :: IO () sendRestart = do dpy <- openDisplay "" diff --git a/dotfiles/commands b/dotfiles/commands @@ -1,98 +1,102 @@ -ans app > note scratch echo scratch-note -ane app > note edit fuzz-note-edit -aci app > cal > interactive echo pcal interactive -acl app > cal > list echo pcal list +G gemini gemmark +Nc new command echo make-script +acar app > cargo apk run --release echo cargo apk run --release +acbd app > cargo build echo cargo build +acbr app > cargo build --release echo cargo build --release +acr app > cargo run echo cargo run +acrr app > cargo run --release echo cargo run --release +ada app > direnv > allow echo direnv allow +afa app > feeds > arxiv fuzz-rss "grep @arxiv" afb app > feeds > blogs fuzz-rss "grep @blog | grep -v @busy" afe app > edit feeds echo edit ~/dotfiles/rssfeeds aff app > feeds fuzz-rss "grep -v @busy" afp app > feeds > podcasts fuzz-rss "grep @pod" -afu app > update feeds echo rssfeeds -ada app > direnv > allow echo direnv allow afs app > feeds > busy fuzz-rss -afa app > feeds > arxiv fuzz-rss "grep @arxiv" +afu app > update feeds echo rssfeeds afy app > feeds > youtube fuzz-rss "grep @yt" +ane app > note edit fuzz-note-edit +ans app > note scratch echo scratch-note ar app > reader fuzz-reader ash app > social > home echo fedi-timeline home asi app > social > interesting echo fedi-timeline list/260 bt btc txs fuzz-btc-txs +cR compile repeat error fuzz-compile-repeat-error 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 less .build-result -dsa docs->stripe->api ~/docs/stripe/jumpapi -dsg docs->stripe->go fuzzdoc ~/docs/stripe/go-v72.txt '^type ' -dgt docs->go->testing fuzzdoc ~/docs/godoc/testing.txt '^func ' -ecc edit vdirsyncer config echo edit ~/.config/vdirsyncer/config -ec edit commands fuzz-edit-scripts -ebc edit build command echo edit .buildcmd -ed edit default.nix echo edit default.nix -es edit shell.nix echo edit shell.nix +co compile open vim echo vim -c \"":cfile build.log | copen | wincmd k\"" +eC edit Cargo.toml echo edit Cargo.toml eFc edit fuzz command fuzz-edit-command eFl edit fuzz command list fuzz-edit-command-list -egc edit git config echo edit ~/.gitconfig eG edit gemmarks echo edit ~/dotfiles/gemmarks -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 ea edit mail aliases echo edit ~/.mail_aliases +ebc edit build command echo edit .buildcmd +ec edit commands fuzz-edit-scripts +ecc edit vdirsyncer config echo edit ~/.config/vdirsyncer/config +ed edit default.nix echo edit default.nix +egc edit git config echo edit ~/.gitconfig +elf edit last files fuzz-last-files edit +em edit mutt config echo edit ~/.config/neomutt/neomuttrc +es edit shell.nix echo edit shell.nix et edit todo echo edit ~/docs/todo/todo.txt +ev edit vim config echo edit ~/.vimrc ff create file echo fuzz-create-file gb git branches echo git bvr -G gemini gemmark +gcp github cherry-pick echo git cherry-pick ghi github issues fuzz-gh-issue-list ghp github prf fuzz-gh-pr-list -gcp github cherry-pick echo git cherry-pick gpm git mlap echo git mlap h run history fuzz-run-hist jt jump tag fuzz-jump-tag -nai notmuch archive inbox fuzz-notmuch-archive-inbox -nep notmuch edit poll echo vim scp://charon//home/jb55/bin/notmuch-poll -nam notmuch am fuzz-notmuch-am -ng notmuch github patch fuzz-notmuch-gam -nat notmuch archive fuzz-notmuch-archive -nm notmuch muchsync echo muchsync charon m mutt echo neomutt mP mutt prs echo neomutt -f damus-prs -mp mutt patches echo neomutt -f patches mi mutt issues echo neomutt -f damus-issues -Nc new command echo make-script -ni notmuch inbox fuzz-notmuch-inbox +mp mutt patches echo neomutt -f patches +mw mutt work echo neomutt -f work +mnw mutt not work echo neomutt -f notwork nT email today echo f nt query:today +nai notmuch archive inbox fuzz-notmuch-archive-inbox +nam notmuch am fuzz-notmuch-am +nat notmuch archive fuzz-notmuch-archive +nep notmuch edit poll echo vim scp://charon//home/jb55/bin/notmuch-poll +ng notmuch github patch fuzz-notmuch-gam +ni notmuch inbox fuzz-notmuch-inbox +nm notmuch muchsync echo muchsync charon nt notmuch threads fuzz-notmuch-threads of open file fuzz-open-file olf open last files fuzz-last-files open -pr cd project root echo cd \"$(project-root)\" pc cat project file fuzz-cat-file -pr cd project root echo cd $(project-root) pf edit project file fuzz-edit-file +pr cd project root echo cd $(project-root) +pr cd project root echo cd \"$(project-root)\" ps edit project skeletons fuzz-edit-file --dir ~/dotfiles/skeletons rf recent files fuzz-recent-files -sc show command fuzz-show-script sFc show fuzz command fuzz-show-fuzz-command +sc show command fuzz-show-script sf search project file funcs fuzz-funcs sgb search git branch fuzz-jump-branchdiff 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 sgm search git modified files fuzz-git-modified +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 st search TODOs fuzz-search-files TODO -vim edit vim config echo edit ~/.config/nvim/init.vim +wdq work dashboard queries fuzzedit queries '^' +wm work mail echo neomutt -f \"notmuch://?query=query:work\" +wn work notes echo edit /home/jb55/projects/steamoji/doc/$(ls -1pt /home/jb55/projects/steamoji/doc | grep -v / | head -n1) wsg work service gql fuzzedit schema '^' wsm work service mutations fuzzedit mutation '^func ' -wsq work service queries fuzzedit query '^func ' wsp work service permissions fuzzedit permission.go '^"' -wdq work dashboard queries fuzzedit queries '^' +wsq work service queries fuzzedit query '^func ' wtb work trello backlog fuzz-trello-sprint "^Backlog " wti work trello inprogress fuzz-trello-sprint "^In Progress " wtr work trello refresh echo trello refresh wts work trello sprint fuzz-trello-sprint wtt work trello todo fuzz-trello-sprint "^Todo " -wn work notes echo edit /home/jb55/projects/steamoji/doc/$(ls -1pt /home/jb55/projects/steamoji/doc | grep -v / | head -n1) -wm work mail echo neomutt -f \"notmuch://?query=query:work\" z fz echo fz diff --git a/dotfiles/skeletons/nix-rust/shell.nix b/dotfiles/skeletons/nix-rust/shell.nix @@ -1,5 +1,5 @@ { pkgs ? import <nixpkgs> {} }: with pkgs; mkShell { - nativeBuildInputs = [ cargo rustc rustfmt libiconv pkgconfig ]; + nativeBuildInputs = [ cargo rustc rustfmt libiconv pkg-config ]; } diff --git a/nix-config/configuration.nix b/nix-config/configuration.nix @@ -23,7 +23,7 @@ let machine = extra.private.machine; caches = [ "https://cache.nixos.org" ]; composeKey = if machine == "quiver" then "ralt" else "prsc"; home = "/home/jb55"; - isDark = false; + isDark = true; bash = "${pkgs.bashInteractive}/bin/bash"; theme = if isDark then { package = pkgs.theme-vertex; @@ -75,6 +75,16 @@ in { DefaultTimeoutStartSec=20s ''; + i18n.inputMethod = { + enabled = "fcitx5"; + fcitx5.addons = with pkgs; [ + fcitx5-gtk + fcitx5-chinese-addons + fcitx5-mozc + fcitx5-nord + ]; + }; + i18n.extraLocaleSettings = { LC_TIME="en_DK.UTF-8"; }; @@ -86,13 +96,17 @@ in { programs.ssh.startAgent = true; time.timeZone = "America/Vancouver"; + system.stateVersion = "24.11"; nixpkgs.config = import ./nixpkgs/config.nix; nix.useSandbox = machine != "charon"; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.trustedUsers = [ "root" "jb55" ]; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix.settings.trusted-substituters = ["https://ai.cachix.org"]; + nix.settings.trusted-public-keys = ["ai.cachix.org-1:N9dzRK+alWwoKXQlnn0H6aUx0lU/mspIoz8hMvGvbbc="]; + boot.blacklistedKernelModules = [ "pcspkr" ]; # STOP THE BEEPING users.extraUsers.jb55 = user; @@ -104,5 +118,6 @@ in { console.useXkbConfig = true; programs.zsh.enable = false; + programs.direnv.enable = true; } diff --git a/nix-config/environment/default.nix b/nix-config/environment/default.nix @@ -8,19 +8,19 @@ let jb55pkgs = import <jb55pkgs> { inherit pkgs; }; sha256 = "0xd86s2smjvlc7rlb6rkgx2hj3c3sbcz3gs8rf93x69jqdvwb6rr"; }) {}; myPackages = with jb55pkgs; [ - #rsslink + rsslink #bcalc - #btcs - #csv-delim - #csv-scripts - #extname - #mandown - #ratio - #samp - #sharefile - #zebra - #define - #nixpkgs-ml-tools + btcs + csv-delim + csv-scripts + extname + mandown + ratio + samp + sharefile + zebra + define + nixpkgs-ml-tools ]; minimal-pkgs = with pkgs; [ @@ -33,10 +33,11 @@ let jb55pkgs = import <jb55pkgs> { inherit pkgs; }; yq tut + curlHTTP3 python3Packages.num2words - python3Packages.howdoi + #python3Packages.howdoi tree - xsv + b4 datefmt #nostril nncp @@ -65,7 +66,7 @@ let jb55pkgs = import <jb55pkgs> { inherit pkgs; }; imagemagick jq lesspipe - libbitcoin-explorer + #libbitcoin-explorer libqalculate linuxPackages.bpftrace linuxPackages.perf @@ -74,7 +75,9 @@ let jb55pkgs = import <jb55pkgs> { inherit pkgs; }; man-pages mdcat minisign - neovim + vim-full + rustup + playerctl nethack network-tools nix-direnv diff --git a/nix-config/environment/desktop/default.nix b/nix-config/environment/desktop/default.nix @@ -3,14 +3,6 @@ let gtk2rc = pkgs.writeText "gtk2rc" '' gtk-icon-theme-name = "${icon-theme.name}" gtk-theme-name = "${theme.name}" - - binding "gtk-binding-menu" { - bind "j" { "move-current" (next) } - bind "k" { "move-current" (prev) } - bind "h" { "move-current" (parent) } - bind "l" { "move-current" (child) } - } - class "GtkMenuShell" binding "gtk-binding-menu" ''; jb55pkgs = import <jb55pkgs> { inherit pkgs; }; @@ -34,17 +26,16 @@ let gtk2rc = pkgs.writeText "gtk2rc" '' }; mypkgs = (with pkgs; [ - obs-studio + blender clipmenu - colorpicker + #colorpicker dasht dmenu - xdragon dunst dynamic-colors feh getmail6 # for getmail-gmail-xoauth-tokens - gnome.gnome-calculator + gnome-calculator gtk-engine-murrine hwi lagrange @@ -56,9 +47,10 @@ let gtk2rc = pkgs.writeText "gtk2rc" '' neomutt notmuch oathToolkit + obs-studio + pamixer pandoc pavucontrol - pamixer pinentry postgresql # psql qalculate-gtk @@ -67,10 +59,9 @@ let gtk2rc = pkgs.writeText "gtk2rc" '' signal-desktop simplescreenrecorder slock - spotify sxiv - todo-txt-cli tdesktop + todo-txt-cli userConfig vdirsyncer w3m @@ -79,6 +70,7 @@ let gtk2rc = pkgs.writeText "gtk2rc" '' xbindkeys xclip xdotool + xdragon xorg.xev xorg.xmodmap xorg.xset @@ -108,17 +100,18 @@ in { environment.variables = lib.mkIf (!extra.is-minimal) { LC_TIME="en_DK.UTF-8"; GDK_PIXBUF_MODULE_FILE = "${pkgs.librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"; - GTK2_RC_FILES = "${gtk2rc}:${theme.package}/share/themes/${theme.name}/gtk-2.0/gtkrc:$GTK2_RC_FILES"; - GTK_DATA_PREFIX = "${theme.package}"; - GTK_EXEC_PREFIX = "${theme.package}"; - GTK_IM_MODULE = "xim"; - GTK_PATH = "${theme.package}:${pkgs.gtk3.out}"; - GTK_THEME = "${theme.name}"; + #GTK2_RC_FILES = "${gtk2rc}:${theme.package}/share/themes/${theme.name}/gtk-2.0/gtkrc:$GTK2_RC_FILES"; + #GTK_DATA_PREFIX = "${theme.package}"; + #GTK_EXEC_PREFIX = "${theme.package}"; + #GTK_IM_MODULE = "xim"; + #GTK_PATH = "${theme.package}:${pkgs.gtk3.out}"; + #GTK_THEME = "${theme.name}"; QT_STYLE_OVERRIDE = "GTK+"; VK_ICD_FILENAMES = "/run/opengl-driver/share/vulkan/icd.d/radeon_icd.x86_64.json"; # radv }; programs.steam.enable = true; + programs.gamemode.enable = true; environment.systemPackages = if extra.is-minimal then (with pkgs; [ diff --git a/nix-config/fonts/default.nix b/nix-config/fonts/default.nix @@ -98,7 +98,17 @@ in open-sans raleway profont + + # chinese + noto-fonts-cjk-sans + source-han-sans + source-han-serif + + # pixel fonts terminus_font + cozette + #ark-pixel-font + paratype-pt-mono source-code-pro ubuntu_font_family diff --git a/nix-config/hardware/desktop/default.nix b/nix-config/hardware/desktop/default.nix @@ -75,6 +75,13 @@ in EndSection Section "InputClass" + Identifier "Lenovo ThinkPad Compact USB Keyboard with TrackPoint" + MatchProduct "Lenovo ThinkPad Compact USB Keyboard with TrackPoint" + Driver "libinput" + Option "AccelSpeed" "0.1" + EndSection + + Section "InputClass" Identifier "Razer Razer DeathAdder 2013" MatchIsPointer "yes" Option "AccelerationProfile" "-1" @@ -100,7 +107,7 @@ in }; - hardware.pulseaudio.enable = true; + hardware.pulseaudio.enable = false; hardware.pulseaudio.support32Bit = true; hardware.pulseaudio.package = if extra.is-minimal then pkgs.pulseaudio else pkgs.pulseaudioFull; hardware.pulseaudio.daemon.config = { @@ -109,7 +116,16 @@ in hardware = { bluetooth.enable = true; - opengl.driSupport32Bit = true; - opengl.driSupport = true; + #opengl.driSupport32Bit = true; + + graphics = { + enable = true; + enable32Bit = true; + }; + + #amdgpu.amdvlk = { + # enable = true; + # support32Bit.enable = true; + #}; }; } diff --git a/nix-config/machines/archer/default.nix b/nix-config/machines/archer/default.nix @@ -124,8 +124,6 @@ in { authPass = private.gmail-pass; }; - services.fcgiwrap.enable = true; - systemd.services.postgresql.after = [ "zerotierone.service" ]; services.postgresql = { diff --git a/nix-config/machines/charon/networking/default.nix b/nix-config/machines/charon/networking/default.nix @@ -7,12 +7,13 @@ let git = 9418; gemini = 1965; starbound = 21025; + terraria = 7777; }; in { services.openssh.gatewayPorts = "yes"; - networking.firewall.allowedTCPPorts = with ports; [ 22 443 80 70 12566 12788 5222 5269 3415 git gemini starbound ]; + networking.firewall.allowedTCPPorts = with ports; [ 22 443 80 70 12566 12788 5222 5269 3415 git gemini terraria ]; networking.domain = "jb55.com"; networking.search = [ "jb55.com" ]; diff --git a/nix-config/machines/monad/bitcoin/default.nix b/nix-config/machines/monad/bitcoin/default.nix @@ -18,7 +18,7 @@ let mkPluginCfg = name: "plugin=${builtins.getAttr name (nix-bitcoin.clightning-plugins)}/${name}.py"; - bitcoinDataDir = "/zbig/bitcoin"; + bitcoinDataDir = "/titan/bitcoin"; base-bitcoin-conf = extra.private.bitcoin; @@ -38,7 +38,10 @@ let addr = extra.private.btc-supplier-addr; }; - walletemail = import ./walletemail.nix { inherit pkgs bcli nostril; inherit (extra) private; }; + walletemail = import ./walletemail.nix { + inherit pkgs bcli nostril; + inherit (extra) private; + }; spark-module = import ./modules/spark-wallet.nix nix-bitcoin.spark-wallet; spark-port = 9962; diff --git a/nix-config/machines/monad/bitcoin/walletemail.nix b/nix-config/machines/monad/bitcoin/walletemail.nix @@ -29,7 +29,7 @@ export GNUPGHOME=/zbig/bitcoin/gpg msg="$(printf "txid: %s\n\naddress: %s\n\namount: %s\n\nconfirmations: %d\n\nwallet: %s\n\ntime: %s\n\nreceived: %s\n\nkeypath: %s\n\n%s\n" \ "$txid" "$address" "$amount" "$confs" "$wallet" "$time" "$received" "$keypath" "$details" )" -${nostril}/bin/nostril --sec ${private.wallet-nostr} --envelope -p 32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245 --content "$msg" | ${pkgs.websocat}/bin/websocat ws://127.0.0.1:8080 +${nostril}/bin/nostril --sec ${private.wallet-nostr} --envelope -p 32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245 --content "$msg" | ${pkgs.nostcat}/bin/nostcat ws://127.0.0.1:8080 wss://notify.damus.io enctx="$(printf "Content-Type: text/plain\n\n%s\n" "$msg" | ${pkgs.gnupg}/bin/gpg --yes --always-trust --encrypt --armor $keys)" diff --git a/nix-config/machines/monad/config/default.nix b/nix-config/machines/monad/config/default.nix @@ -1,6 +1,8 @@ pkgs: rec { hostId = "d7ee0243"; # needed for zfs ztip = "10.100.0.1"; + subnet = "192.168.86.1/24"; + ip = "192.168.86.25"; nix-serve = { port = 10845; bindAddress = ztip; diff --git a/nix-config/machines/monad/default.nix b/nix-config/machines/monad/default.nix @@ -27,6 +27,7 @@ in { imports = [ ./hardware + (import ./rocksmith.nix) # ./contracts/commit # ./contracts/plastiq @@ -38,13 +39,32 @@ in #hardware.steam-hardware.enable = true; - boot.zfs.enableUnstable = true; + #boot.zfs.enableUnstable = true; boot.zfs.removeLinuxDRM = true; - boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; + #boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; + + # ai + #services.comfyui.enable = false; + #services.comfyui.rocmSupport = true; + #services.comfyui.dataPath = "/titan/ai/comfyui"; + services.ollama = { + enable = true; + host = "0.0.0.0"; + acceleration = "rocm"; + environmentVariables = { + HCC_AMDGPU_TARGET = "gfx1010"; # used to be necessary, but doesn't seem to anymore + }; + rocmOverrideGfx = "10.1.0"; + }; + + services.n8n.enable = true; services.ofono.enable = false; services.ofono.plugins = with pkgs; [ ofono-phonesim ]; + services.open-webui.enable = true; + services.open-webui.port = 8090; + services.prometheus.enable = false; # services.prometheus.dataDir = "/zbig/data/prometheus"; services.grafana.enable = false; @@ -58,7 +78,7 @@ in ]; # services.guix.enable = true; - services.synergy.client.enable = if extra.is-minimal then false else true; + services.synergy.client.enable = if extra.is-minimal then false else false; services.synergy.client.autoStart = true; services.synergy.client.serverAddress = "10.100.0.2"; services.synergy.client.screenName = "monad"; @@ -106,13 +126,15 @@ in }; services.dnsmasq.enable = true; - services.dnsmasq.resolveLocalQueries = true; + services.dnsmasq.resolveLocalQueries = false; #services.dnsmasq.servers = ["127.0.0.1#43"]; # services.dnsmasq.servers = ["127.0.0.1#43" "1.1.1.1" "8.8.8.8"]; services.dnsmasq.settings.server = ["8.8.8.8" "8.8.4.4" ]; services.dnsmasq.settings.conf-file = "/var/dnsmasq-hosts"; services.dnsmasq.settings.addn-hosts = "/var/hosts"; - services.dnsmasq.settings.dns-forward-max = 1024; + services.dnsmasq.settings.dns-forward-max = 12000; + services.dnsmasq.settings.min-cache-ttl = 300; + services.dnsmasq.settings.rebind-domain-ok = ""; services.bitlbee.plugins = with pkgs; [ bitlbee-mastodon @@ -132,7 +154,6 @@ in # crude way to clear the cache... systemctl restart dnsmasq - pkill qutebrowser ''; startAt = "Mon..Fri *-*-* 09:00:00"; @@ -222,20 +243,21 @@ in ''; }; - #virtualisation.libvirtd.enable = false; - #virtualisation.libvirtd.qemuOvmf = false; - #virtualisation.libvirtd.qemuVerbatimConfig = '' - # user = "jb55" - # group = "kvm" - # cgroup_device_acl = [ - # "/dev/input/by-id/usb-Topre_Corporation_Realforce-event-kbd", - # "/dev/input/by-id/usb-Razer_Razer_DeathAdder_2013-event-mouse", - # "/dev/null", "/dev/full", "/dev/zero", - # "/dev/random", "/dev/urandom", - # "/dev/ptmx", "/dev/kvm", "/dev/kqemu", - # "/dev/rtc","/dev/hpet", "/dev/sev" - # ] - #''; + virtualisation.libvirtd = { + enable = false; + qemu = { + package = pkgs.qemu_kvm; + runAsRoot = true; + swtpm.enable = true; + ovmf = { + enable = false; + #packages = [(pkgs.OVMF.override { + # secureBoot = true; + # tpmSupport = true; + #}).fd]; + }; + }; + }; systemd.user.services.btc-ban-aws = { enable = if extra.is-minimal then false else true; @@ -270,11 +292,11 @@ in "rcon.password" = "minecraft"; }; - virtualisation.virtualbox.host.enable = false; + virtualisation.virtualbox.host.enable = true; virtualisation.virtualbox.host.enableHardening = false; #virtualization.virtualbox.host.enableExtensionPack = true; - users.extraUsers.jb55.extraGroups = [ "vboxusers" "bitcoin" "kvm" "input" ]; + users.extraUsers.jb55.extraGroups = [ "vboxusers" "bitcoin" "kvm" "qemu-libvirtd" "libvirtd" "input" ]; services.xserver.videoDrivers = [ ]; @@ -305,8 +327,6 @@ in services.tor.client.enable = true; services.tor.settings = extra.private.tor.settings; - services.fcgiwrap.enable = if extra.is-minimal then false else true; - services.nix-serve.enable = false; services.nix-serve.bindAddress = nix-serve.bindAddress; services.nix-serve.port = nix-serve.port; diff --git a/nix-config/machines/monad/hardware/default.nix b/nix-config/machines/monad/hardware/default.nix @@ -13,7 +13,7 @@ boot.kernelParams = [ "amdgpu.gpu_recovery=1" ]; boot.kernelModules = [ "kvm-amd" "kvm-intel" ]; boot.loader.grub.copyKernels = true; - boot.extraModulePackages = [ ]; + #boot.extraModulePackages = [ config.boot.kernelPackages.rtl8188eus-aircrack ]; fileSystems."/" = { device = "znix/root/nixos"; @@ -25,15 +25,20 @@ fsType = "zfs"; }; - fileSystems."/zbig" = - { device = "zbig"; + #fileSystems."/zbig" = + # { device = "zbig"; + # fsType = "zfs"; + # }; + + fileSystems."/chonk" = + { device = "chonk"; fsType = "zfs"; }; - #fileSystems."/chonk" = - # { device = "chonk"; - # fsType = "zfs"; - # }; + fileSystems."/titan" = + { device = "titan"; + fsType = "zfs"; + }; # swapDevices = # [ { device = "/dev/disk/by-uuid/d4e4ae51-9179-439d-925b-8df42dd1bfc5"; } diff --git a/nix-config/machines/monad/networking/default.nix b/nix-config/machines/monad/networking/default.nix @@ -3,8 +3,8 @@ extra: let chromecastIP = "192.168.87.190"; iptables = "iptables -A nixos-fw"; - ipr = "${pkgs.iproute}/bin/ip"; - hasVPN = true; + ipr = "${pkgs.iproute2}/bin/ip"; + hasVPN = false; writeBash = extra.util.writeBash; transmission-dir = "/zbig/torrents"; download-dir = "${transmission-dir}/Downloads"; @@ -21,7 +21,7 @@ let ${extra.private.vpncred.pass} ''; routeup = writeBash "openvpn-pia-routeup" '' - ${pkgs.iproute}/bin/ip route add default via $route_vpn_gateway dev $dev metric 1 table ${vpn.table} + ${ipr} route add default via $route_vpn_gateway dev $dev metric 1 table ${vpn.table} exit 0 ''; # up = writeBash "openvpn-pia-preup" config.services.openvpn.servers.pia.up; @@ -35,25 +35,36 @@ let lntun = 7878; dns = 53; http = 80; + ssh = 22; wireguard = 51820; weechat = 9000; + webdev = 8080; + testdamuspush = 8766; nncp = 5442; starbound = 21025; + terraria = 7777; + ollama = 11434; + bg3 = 23253; inherit (extra.private) notify-port; }; firewallRules = (with ports; [ - "nixos-fw -s 10.100.0.0/24,192.168.86.1/24 -p tcp --dport 8080 -j nixos-fw-accept" # dev - "nixos-fw -s 10.100.0.0/24,192.168.86.1/24 -p tcp --dport 5442 -j nixos-fw-accept" - "nixos-fw -s 10.100.0.0/24,192.168.86.1/24 -p tcp --dport ${toString starbound} -j nixos-fw-accept" + "nixos-fw -s 10.100.0.0/24,${extra.machine.subnet} -p tcp --dport ${toString webdev} -j nixos-fw-accept" # dev + "nixos-fw -s 10.100.0.0/24,${extra.machine.subnet} -p tcp --dport ${toString testdamuspush} -j nixos-fw-accept" # damus push notification test server + "nixos-fw -s 10.100.0.0/24,${extra.machine.subnet} -p tcp --dport ${toString nncp} -j nixos-fw-accept" + "nixos-fw -s 10.100.0.0/24,${extra.machine.subnet} -p tcp --dport ${toString terraria} -j nixos-fw-accept" + "nixos-fw -s 10.100.0.0/24,${extra.machine.subnet} -p tcp --dport ${toString ollama} -j nixos-fw-accept" + "nixos-fw -s 192.168.86.1/24 -p udp --dport ${toString wireguard} -j nixos-fw-accept" + "nixos-fw -s 192.168.86.1/24 -p tcp --dport ${toString bg3} -j nixos-fw-accept" + "nixos-fw -s 192.168.86.1/24 -p udp --dport ${toString bg3} -j nixos-fw-accept" "nixos-fw -s 10.100.0.0/24 -p tcp --dport 80 -j nixos-fw-accept" "nixos-fw -s 10.100.0.0/24 -p tcp --dport 3000 -j nixos-fw-accept" "nixos-fw -s 10.100.0.0/24 -p tcp --dport 25565 -j nixos-fw-accept" "nixos-fw -s 10.100.0.0/24 -p tcp --dport 25575 -j nixos-fw-accept" "nixos-fw -s 10.100.0.2/32 -p tcp --dport ${toString lntun} -j nixos-fw-accept" "nixos-fw -s 10.100.0.0/24 -p tcp --dport ${toString weechat} -j nixos-fw-accept" - "nixos-fw -s 10.100.0.0/24,192.168.86.1/24 -p tcp --dport 8333 -j nixos-fw-accept" # bitcoin - "nixos-fw -s 10.100.0.0/24,192.168.86.1/24 -p tcp --dport 8332 -j nixos-fw-accept" # bitcoin-rpc + "nixos-fw -s 10.100.0.0/24,${extra.machine.subnet} -p tcp --dport 8333 -j nixos-fw-accept" # bitcoin + "nixos-fw -s 10.100.0.0/24,${extra.machine.subnet} -p tcp --dport 8332 -j nixos-fw-accept" # bitcoin-rpc "nixos-fw -s 192.168.122.218 -p udp --dport 137 -j nixos-fw-accept" "nixos-fw -s 192.168.122.218 -p udp --dport 138 -j nixos-fw-accept" "nixos-fw -s 192.168.122.218 -p tcp --dport 139 -j nixos-fw-accept" @@ -167,7 +178,7 @@ in services.jellyfin.enable = false; services.plex = { - enable = true; + enable = false; group = "transmission"; openFirewall = true; }; @@ -287,13 +298,13 @@ in } ''; - systemd.services.transmission.enable = false; + systemd.services.transmission.enable = hasVPN; systemd.services.transmission.requires = [ "openvpn-pia.service" ]; systemd.services.transmission.after = [ "openvpn-pia.service" ]; systemd.services.transmission.serviceConfig.User = lib.mkForce "root"; systemd.services.transmission.serviceConfig.ExecStart = lib.mkForce ( writeBash "start-transmission-under-vpn" '' - exec ${pkgs.libcgroup}/bin/cgexec --sticky -g net_cls:pia \ + ${pkgs.libcgroup}/bin/cgexec --sticky -g net_cls:pia \ ${pkgs.sudo}/bin/sudo -u transmission \ ${pkgs.transmission}/bin/transmission-daemon \ -f \ @@ -324,7 +335,7 @@ in users.extraGroups.tor.members = [ "jb55" ]; systemd.services.openvpn-pia.path = [ pkgs.libcgroup ]; - services.openvpn.servers = { + services.openvpn.servers = if hasVPN then { pia = { autoStart = false; @@ -332,7 +343,7 @@ in client dev tun proto udp - remote 66.115.146.27 1194 + remote 37.19.212.142 1194 resolv-retry infinite remote-random nobind @@ -346,17 +357,19 @@ in ping-timer-rem reneg-sec 0 comp-lzo no + verify-x509-name CN=ca1515.nordvpn.com remote-cert-tls server auth-user-pass ${vpn.credfile} - fast-io - cipher AES-256-CBC - auth SHA512 - route-noexec route-up ${vpn.routeup} + verb 3 + pull + fast-io + cipher AES-256-CBC + auth SHA512 <ca> -----BEGIN CERTIFICATE----- MIIFCjCCAvKgAwIBAgIBATANBgkqhkiG9w0BAQ0FADA5MQswCQYDVQQGEwJQQTEQ @@ -440,7 +453,7 @@ in rm -rf /sys/fs/cgroup/net_cls/${vpn.name} ''; }; - }; + } else {}; networking.firewall.checkReversePath = false; networking.firewall.logReversePathDrops = true; diff --git a/nix-config/machines/monad/rocksmith.nix b/nix-config/machines/monad/rocksmith.nix @@ -0,0 +1,37 @@ +{ config, lib, pkgs, ... }: +{ + services.pipewire = { + enable = true; + jack.enable = true; + }; + + ### Audio Extra + security.rtkit.enable = true; # Enables rtkit (https://directory.fsf.org/wiki/RealtimeKit) + + # domain = "@audio": This specifies that the limits apply to users in the @audio group. + # item = "memlock": Controls the amount of memory that can be locked into RAM. + # value (`unlimited`) allows members of the @audio group to lock as much memory as needed. This is crucial for audio processing to avoid swapping and ensure low latency. + # + # item = "rtprio": Controls the real-time priority that can be assigned to processes. + # value (`99`) is the highest real-time priority level. This setting allows audio applications to run with real-time scheduling, reducing latency and ensuring smoother performance. + # + security.pam.loginLimits = [ + { domain = "@audio"; item = "memlock"; type = "-"; value = "unlimited"; } + { domain = "@audio"; item = "rtprio"; type = "-"; value = "99"; } + ]; + + # Add user to `audio` and `rtkit` groups. + users.users.jb55.extraGroups = [ "audio" "rtkit" ]; + + environment.systemPackages = with pkgs; [ + qjackctl + rtaudio + ]; + + ### Steam (https://nixos.wiki/wiki/Steam) + programs.steam.package = pkgs.steam.override { + extraLibraries = pkgs: [ pkgs.pkgsi686Linux.pipewire.jack ]; # Adds pipewire jack (32-bit) + }; + + programs.steam.extraPackages = [ pkgs.wineasio ]; +} diff --git a/nix-config/misc/dnsmasq-adblock.nix b/nix-config/misc/dnsmasq-adblock.nix @@ -15,6 +15,9 @@ in services.dnsmasq.servers = ["8.8.8.8" "1.1.1.1"]; services.dnsmasq.extraConfig = '' addn-hosts=${adblock-hosts} + dns-forward-max=5096 + min-cache-ttl=300 + rebind-domain-ok= conf-file=${dnsmasq-adblock} ''; } diff --git a/nix-config/nixpkgs/config.nix b/nix-config/nixpkgs/config.nix @@ -15,16 +15,24 @@ in { allowBroken = false; checkMeta = true; zathura.useMupdf = true; + cudaSupport = false; + rocmSupport = false; #android_sdk.accept_license = true; packageOverrides = super: rec { - qemu = super.qemu.override { - smbdSupport = true; + qutebrowser = super.qutebrowser.override { + enableWideVine = true; }; + #qemu = super.qemu.override { + # smbdSupport = true; + #}; + +/* mpv = pkgs.wrapMpv pkgs.mpv-unwrapped { scripts = [ pkgs.mpvScripts.mpris ]; }; + */ # /run/current-system/sw/bin/ls $HOME/.emacs.d/elpa | sed 's/-[[:digit:]].*//g;s/\+$/-plus/g' | sort -u #emacs = super.emacsHead; diff --git a/nix-config/services/desktop/default.nix b/nix-config/services/desktop/default.nix @@ -46,7 +46,7 @@ in ''; programs.gnupg.agent.enable = true; - programs.gnupg.agent.pinentryFlavor = "gtk2"; + #programs.gnupg.agent.pinentryFlavor = "gtk2"; # programs.gnupg.trezor-agent = { # enable = if extra.is-minimal then false else true;