citadel

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

commit 7c9440bb74d994da752f89737c532028d9bef89c
parent 0ab316863b56c3cd62e17d0ec2467aab9c19a84e
Author: William Casarin <jb55@jb55.com>
Date:   Sat,  6 Nov 2021 14:12:49 -0700

charon updates

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

Diffstat:
Mbin/notmuch-poll | 5++++-
Mdotfiles/.bash_aliases | 272+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mnix-config/environment/default.nix | 2+-
Mnix-config/machines/charon/default.nix | 83+++++++++++++++++++++++--------------------------------------------------------
Mnix-config/machines/charon/dovecot/filters.sieve | 4++++
Mnix-config/services/mailz/default.nix | 1+
6 files changed, 306 insertions(+), 61 deletions(-)

diff --git a/bin/notmuch-poll b/bin/notmuch-poll @@ -76,7 +76,7 @@ notmuchcmd tag +work +commit tag:github and tag:inbox and to:commitdev notmuchcmd tag +flagged -busy -filed tag:inbox and '(tag:list and tag:to-me) or to:mention@noreply.github.com or author@noreply.github.com or to:review_requested@noreply.github.com or to:comment@noreply.github.com or (subject:jb55 and tag:github)' # spam -notmuchcmd tag +spam -inbox 'subject:"BOOM OF SALES"' and tag:inbox +notmuchcmd tag +spam -inbox 'from:"BOOM OF SALES"' and tag:inbox # not spam notmuchcmd tag +inbox -spam +flagged "bitcoin wizard" and tag:spam @@ -84,4 +84,7 @@ notmuchcmd tag +inbox -spam +flagged "bitcoin wizard" and tag:spam # phone mail notmuchcmd tag -inbox tag:inbox and '(folder:".Archive" or folder:".Trash" or folder:".Archives")' +# bulk bs +notmuchcmd tag +filed +bulk 'folder:".Bulk"' + printf "notmuch tagging done.\n" diff --git a/dotfiles/.bash_aliases b/dotfiles/.bash_aliases @@ -1 +1,273 @@ #!/usr/bin/env bash +# generic stuff for non-interactive shells + +# sharefile +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 +fi + +export NNCPCFG=~/.nncprc +export PANDOC=pandoc-nice +export BAT_STYLE=plain +export LPASS_HOME="$HOME/.config/lpass" +export FUZZER=fzf +export GOPHERCLIENT=vf1 +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} +export VI_MODE=1 +export XZ=pxz +export HISTSIZE=50000 +export FZF_CTRL_R_OPTS="-e" +export FZF_DEFAULT_OPTS="-e" +export FZF_DEFAULT_COMMAND='rg --files --hidden' +export EMACSCLIENT=edit + +export NIXPKGS=$HOME/nixpkgs + +# nix paths +export NIX_PATH="nixpkgs=$NIXPKGS:$NIX_PATH" +export NIX_PATH="nixos-config=$NIX_FILES:$NIX_PATH" +export NIX_PATH="jb55pkgs=$HOME/etc/jb55pkgs:$NIX_PATH" +export NIX_PATH="dotfiles=$HOME/dotfiles:$NIX_PATH" + +# Customize to your needs... + +# other +export EDITOR="edit" +export VISUAL="edit" +export BROWSER="browser" +export PAGER=less + +# go + +export GOPATH=$HOME/dev/gocode +export PATH=$HOME/bin:$PATH +export PATH=$HOME/.local/bin:$PATH +export PATH=$HOME/.npm/bin:$PATH + +md () { + mandown README* +} + +function run_fuzzer() { + eval "$(fuzz-run-command "$@")" +} + +alias C="pcal list" +alias m="neomutt" +alias mq="msmtp-queue" +alias s="general-status" +alias t="todo.sh" +alias e="edit -n" +alias g=git +alias f=run_fuzzer +alias vim=nvim +alias feh="feh --conversion-timeout 2" +alias info="info --vi-keys" +alias ag="ag --pager=less" +alias attach="grabssh; screen -rD" +alias awkt="awk -v FS=$'\t' -v OFS=$'\t'" +alias catt="pygmentize -O style=monokai -f console256 -g" +alias clip="xclip -selection clipboard" +alias cpptags="ctags -R --sort=1 --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++" +alias crontab="VIM_CRONTAB=true crontab" +alias cutt="cut -d $'\t' --output-delimiter=$'\t'" +alias emacs="env TERM=xterm-256color emacs" +alias fixssh="source $HOME/bin/fixssh" +alias githist="git reflog show | grep '}: commit' | nl | sort -nr | nl | sort -nr | cut --fields=1,3 | sed s/commit://g | sed -e 's/HEAD*@{[0-9]*}://g'" +alias jsonpp="python -mjson.tool" +alias ls="ls --color" +alias noder="env NODE_NO_READLINE=1 rlwrap node" +alias nr="npm run" +alias page=$PAGER +alias prettyjson=jsonpp +alias sorry='sudo $(fc -l -n -1)' +alias tmuxa="tmux a -d -t " +alias tmux="tmux -2" +alias vless="/usr/share/vim/vim72/macros/less.sh" +alias vnc_once="x11vnc -safer -nopw -once -display :0" +alias wget="wget -c" +alias xclip="xclip -selection clipboard" +alias myip="dig +short myip.opendns.com @resolver1.opendns.com" +alias wanip=myip +alias myipaddress=myip +alias ns="nix-shell -p" +alias fzf="fzf --exact" +alias u="cd .." +alias scs="systemctl status" +alias scsu="systemctl status --user" +alias jc="journalctl -u" +alias jcu="journalctl --user -u" + +ghclone () { + cd "$(gh-clone "$@")" +} + +srhtclone () { + cd "$(srht-clone "$@")" +} + +cdnp () { + nix-build '<nixpkgs>' --no-out-link -A "$1" + cd $(nix-path "$1") +} + +np () { + nix-path "$1" +} + +nsr () { + local cmd="$1" + shift + nix-shell -p "$cmd" --run "$@" +} + +nsr2 () { + local cmd="$1" + shift + local cmd2="$(<<<"$cmd" rev | cut -d. -f1 | rev) $@" + nsr "$cmd" "$cmd2" +} + +nsc () { + local cmd="$1" + shift + nix-shell -p "$cmd" --command "$@" +} + +share () { + sharefile "$@" | xclip +} + +sharess () { + share_last_ss | xclip +} + +lt () { + ls -ltah "$@" | "$PAGER" +} + +lt1 () { + res=$(\ls -1 -t "$@" | head -n1) + xclip <<<"$res" + printf '%s\n' "$res" +} + +mv1 () { + mv $(lt1 | stripansi) "$@" +} + +pcsv () { + csv-delim "$@" | pcsvt +} + +pcsvt () { + columnt "$@" | cat -n | less -R -S +} + +header() { + headers "${2:-/dev/stdin}" | grep "$1" | cutt -f1 | sed -E 's,^[ ]*,,g' +} + +nsum() { + awkt '{total = total + $1}END{print total}' +} + +sumcol() { + cut -f "$1" | nsum +} + +uniqc() { + sort "$@" | uniq -c | sort -nr +} + +cdl () { + cd "$(dirname "$(readlink -f "$(which "$1")")")" +} + +env-type () { + envtype="$1" + shift + nix-shell -Q -p $envtype "$@" +} + +haskell-env () { + env-type "haskellEnv" "$@" +} + +haskell-env-hoogle () { + env-type "haskellEnvHoogle" "$@" +} + +haskell-env-tools() { + env-type "haskellTools" "$@" +} + +build-nix-cache() { + nix-env -f "$NIXPKGS" -qaP \* > ~/.nixenv.cache +} + +haskell-shell() { + nix-shell -p "haskellPackages.ghcWithPackages (pkgs: with pkgs; [$*])" +} + +nix-path() { + nix-instantiate --eval --expr 'with import <nixpkgs> {}; "${'"$1"'}"' | sed 's/"//g' +} + +vnc-once() { + x11vnc -safer -nopw -once -display ':0' "$1" +} + +sql_wineparty() { + export CS='postgres://wineparty.xyz/wineparty' + export PG_USER='jb55' +} + +sql_() { + local query="$1" + local args=("-U" "$pg_user" -A) + if [ ! -z "$query" ]; + then + args+=(-c "$query") + fi + psql -F $'\t' "${args[@]}" +} + +sql() { + sql_ "$@" -t | pcsvt +} + +# fzf +source $DOTFILES/.fzf_helpers + +# z +source $HOME/bin/z.sh + +# private stuff +source $HOME/.bash_private + +# nix +#. /Users/jb55/.nix-profile/etc/profile.d/nix.sh + +CURL_CA_BUNDLE=/opt/local/share/curl/curl-ca-bundle.crt diff --git a/nix-config/environment/default.nix b/nix-config/environment/default.nix @@ -21,7 +21,7 @@ let jb55pkgs = import <jb55pkgs> { inherit pkgs; }; sharefile zebra define - nixpkgs-ml-tools + #nixpkgs-ml-tools ]; myHaskellPackages = with pkgs.haskellPackages; [ #skeletons diff --git a/nix-config/machines/charon/default.nix b/nix-config/machines/charon/default.nix @@ -14,15 +14,8 @@ let gitExtra = { npmrepo = (import (pkgs.fetchFromGitHub { owner = "jb55"; repo = "npm-repo-proxy"; - rev = "bef839a95736588ec40c917fa63d490cd736f307"; - sha256 = "1j2xclgcmz9hbf47k4ygyzmiradfg9q30m8bzr1i2x91kz1ck946"; - }) {}).package; - - gaufre = (import (pkgs.fetchFromGitHub { - owner = "jb55"; - repo = "gaufre"; - rev = "fe9d3cb3a6e4616d1f2f95607cea3a0582db4872"; - sha256 = "091lbcijfzbbr3sm4nxqzz5pdgwqlhhxsa6qy0svmk44q3nd6zvh"; + rev = "5bb651689c9e74299094ac989125685c810ee9b2"; + sha256 = "16cjcz2cakrgl3crn63s5w1k4h4y51h8v0326v5bim8r1hxrpq4n"; }) {}).package; pgpkeys = pkgs.fetchurl { @@ -124,19 +117,6 @@ in #(import ./vidstats extra) ]; - services.xinetd.enable = true; - services.xinetd.services = - [ - { name = "gopher"; - port = 70; - server = "${pkgs.gophernicus}/bin/in.gophernicus"; - serverArgs = "-h jb55.com -nf -r /var/gopher"; - extraConfig = '' - disable = no - ''; - } - ]; - users.extraGroups.jb55cert.members = [ "prosody" "nginx" "radicale" ]; users.extraGroups.vmail.members = [ "jb55" ]; @@ -225,13 +205,15 @@ in users.extraUsers.smtpd.extraGroups = [ "jb55cert" ]; users.extraUsers.jb55.extraGroups = [ "jb55cert" ]; + #users.extraUsers.prosody.extraGroups = [ "jb55cert" ]; services.prosody.enable = false; + services.prosody.xmppComplianceSuite = false; services.prosody.admins = [ "jb55@jb55.com" ]; services.prosody.allowRegistration = false; services.prosody.extraModules = xmpp_modules; services.prosody.package = pkgs.prosody.override { - withCommunityModules = xmpp_modules; + withCommunityModules = xmpp_modules; }; services.prosody.extraConfig = '' c2s_require_encryption = true @@ -349,36 +331,9 @@ in } server { - listen 80; - listen [::]:80; - - server_name social.jb55.com; - - location /.well-known/acme-challenge { - root /var/www/challenges; - } - - location / { - return 301 https://social.jb55.com$request_uri; - } - } - - server { listen 443 ssl; listen [::]:443 ssl; - server_name social.jb55.com; - - ssl_certificate /var/lib/acme/social.jb55.com/fullchain.pem; - ssl_certificate_key /var/lib/acme/social.jb55.com/key.pem; - - location / { - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $remote_addr; - proxy_set_header Host $http_host; - proxy_pass http://127.0.0.1:5188/; - } - } server { @@ -483,20 +438,28 @@ in rewrite ^/pkgs.tar.gz$ https://github.com/jb55/jb55pkgs/archive/master.tar.gz permanent; rewrite ^/pkgs/?$ https://github.com/jb55/jb55pkgs/archive/master.tar.gz permanent; - if ( $http_accept ~ "application/activity\+json" ) { - return 302 https://social.jb55.com; - } - - if ( $http_accept ~ "application/ld\+json" ) { - return 302 https://social.jb55.com; - } - + location /inbox { + proxy_set_header Host $http_host; + proxy_redirect off; + proxy_pass http://127.0.0.1:5188/inbox; + } location / { gzip on; gzip_types application/json; charset utf-8; + proxy_set_header Host $http_host; + proxy_redirect off; + + if ( $http_accept ~ "application/activity\+json" ) { + proxy_pass http://127.0.0.1:5188; + } + + if ( $http_accept ~ "application/ld\+json" ) { + proxy_pass http://127.0.0.1:5188; + } + try_files $uri $uri/ =404; } @@ -527,7 +490,9 @@ in } location /.well-known/webfinger { - return 302 https://social.jb55.com$request_uri; + proxy_pass http://localhost:5188/; + proxy_redirect off; + proxy_set_header Host $host; } location = /.well-known/openpgpkey/jb55.com/hu/9adqqiba8jxrhu5wf18bfapmnwjk5ybo { diff --git a/nix-config/machines/charon/dovecot/filters.sieve b/nix-config/machines/charon/dovecot/filters.sieve @@ -193,3 +193,7 @@ if allof (header :contains "from" "noreply@md.getsentry.com") { fileinto "Alerts"; } + +if allof ( header "Precedence" "bulk" ) { + fileinto "Bulk"; +} diff --git a/nix-config/services/mailz/default.nix b/nix-config/services/mailz/default.nix @@ -278,6 +278,7 @@ in } ${mailbox "Alerts"} + ${mailbox "Bulk"} ${mailbox "RSS"} ${mailbox "GitHub"} ${mailbox "Lists"}