commit e345080a6a2ff2455607c76c893da18f6cc1edc5 parent c61273603bf77951d51fd5fcc804a7da1611de62 Author: William Casarin <jb55@jb55.com> Date: Sun, 28 Jan 2024 13:23:47 -0800 Merge remote-tracking branch 'purple/purple' Diffstat:
30 files changed, 385 insertions(+), 130 deletions(-)
diff --git a/bin/fuzz-notmuch-am b/bin/fuzz-notmuch-am @@ -1,4 +1,4 @@ #!/usr/bin/env bash set -eou pipefail -notmuch am -s --am -f ${1:-'tag:inbox and subject:PATCH'} +echo notmuch am -s --am -f ${1:-query:patches} diff --git a/bin/fuzz-notmuch-gam b/bin/fuzz-notmuch-gam @@ -1,5 +1,5 @@ #!/usr/bin/env bash -#set -eou pipefail +set -eo pipefail #slug="" slug=${1:-$(github-project-slug)} if [ $slug != "" ] @@ -14,4 +14,4 @@ fzf --no-sort -m | cutt -f2 | xargs -I{} printf 'thread:{}\n') -echo "notmuch show $thread | mail-prpatch" +echo "notmuch show $thread | mail-prpatch | $(git config core.pager)" diff --git a/bin/fuzz-trello-sprint b/bin/fuzz-trello-sprint @@ -2,30 +2,10 @@ set -eo pipefail -board=${TRELLO_BOARD:-Sprint} - -all=$(cat <<\EOS -/^[^*]/ { - list="" - for(i=6;i<=NF;i++) { - list = list" "$i - } -} - -/^\*/ { - print list " " $0 -} -EOS -) - -stripansi() { - sed 's/\x1b\[[0-9;]*m//g' -} - -card=$(trello show-cards -b $board | stripansi | awk "$all" | fuzzer "$1") +card=$(trello-cards | fuzzer "$1") #list=$(trello show-lists -b $board | grep ID | fuzzer "$1" | sed -En 's,^([^(]+) \(ID:.*,\1,p') #card=$(trello show-cards -b $board -l "$list" | grep '^\*' | fzf) -card_id=$(sed -En 's,.*\* ([^ ]+).*,\1,p' <<<"$card") +card_id=$(trello-card-id <<<"$card") card_name=$(cut -d- -f 2- <<<"$card") list=$(cut -d\* -f1 <<<"$card") echo "trello card-details $card_id | less --quit-if-one-screen # $list > $card_name" diff --git a/bin/git-author-stats b/bin/git-author-stats @@ -22,7 +22,7 @@ fi (printf $'name\tadded\tremoved\tcommits\n'; -git log --numstat --pretty=$'%aN' "$@" \ +git log --numstat --pretty=$'%aN <%aE>' "$@" \ | awk -F$'\t' "$script" \ | sort --field-separator=$'\t' -k${ASTATS_SORT_COLUMN:-2} -g${REVERSE} ) > /tmp/git-author-stats diff --git a/bin/mutt-local-date b/bin/mutt-local-date @@ -1,4 +1,4 @@ -#!/home/jb55/bin/perln +#!/usr/bin/env -S perl -n use Date::Parse; use POSIX; diff --git a/bin/nannypay b/bin/nannypay @@ -7,6 +7,8 @@ if [ -z "$NANNY" ]; then exit 1 fi +pay=20 + if [ -z $pay ]; then printf "unknown pay for %s\n" "$NANNY" exit 1 diff --git a/bin/notmuch-gam b/bin/notmuch-gam @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eou pipefail -cmd=$(fuzz-notmuch-gam) +cmd=$(fuzz-notmuch-gam "$@") $cmd diff --git a/bin/notmuch-poll b/bin/notmuch-poll @@ -11,72 +11,18 @@ notmuchcmd tag +filed +bulk 'folder:".Bulk"' # sent notmuchcmd tag +sent tag:inbox and not tag:sent and folder:".Sent" -# lobsters, ycombinator -notmuchcmd tag +lobsters +rss +tech +busy tag:inbox and not tag:lobsters and folder:".Lists.lobsters" - -# promote from busy if its interesting -notmuchcmd tag -busy +haskell tag:inbox and not tag:haskell and '(tag:lobsters or tag:hn)' and subject:haskell -notmuchcmd tag -busy +nix tag:inbox and not tag:nix and '(tag:lobsters or tag:hn)' and subject:nix -notmuchcmd tag +list tag:inbox and to:"groups.io" - -# notmuch stuff -notmuchcmd tag +francesc \(from:elies@posteo.net or from:francesc.elies@gmail.com\) and not tag:francesc -notmuchcmd tag +notmuch +list to:notmuch and tag:inbox and not tag:notmuch - # me -notmuchcmd tag +to-me not tag:to-me and and tag:inbox and \(to:jackbox55@gmail.com or to:jb55@jb55.com\) -notmuchcmd tag -to-me tag:to-me and tag:inbox and from:discoursemail.com - -notmuchcmd tag +flagged tag:inbox and not tag:flagged and to:jackbox55+star@gmail.com - -# annoying -notmuchcmd tag +alert tag:inbox and folder:".Alerts" -notmuchcmd tag +update tag:inbox and folder:".Update" -notmuchcmd tag +alert +circleci tag:inbox and from:builds@circleci.com -notmuchcmd tag +alert +trello tag:inbox and from:trello -notmuchcmd tag +alert +sentry tag:inbox and from:noreply@md.getsentry.com or from:noreply@outbound.getsentry.com -notmuchcmd tag +ci tag:inbox and from:gl@blockstream.io and subject:Pipeline - -# linux -notmuchcmd tag +linux +list to:vger.kernel.org and tag:inbox and not tag:linux -notmuchcmd tag +mesa +linux +list to:mesa-dev and tag:inbox and not tag:mesa -notmuchcmd tag +git +list to:git@vger.kernel.org and tag:inbox and not tag:git - - -# forums -notmuchcmd tag +bitcoin +list folder:".Lists.bitcoin" and tag:inbox -notmuchcmd tag +best -filed +bitcoin-dev +bitcoin +list to:"bitcoin-dev@lists.linuxfoundation.org" and tag:inbox and not tag:bitcoin-dev -notmuchcmd tag +cypherpunks +list 'from:cypherpunks@lists.cpunks.org' and tag:inbox -notmuchcmd tag +bitcoin +core to:bitcoin@noreply.github.com and tag:inbox and subject:bitcoin/bitcoin -notmuchcmd tag +bitcoin +core +gui to:bitcoin-core/gui and tag:inbox -notmuchcmd tag +bitcoin +busy +bips to:"bitcoin/bips" and tag:inbox -notmuchcmd tag +lightning to:"lightningnetwork/" and tag:inbox -notmuchcmd tag +crypto +list to:cryptography.metzdowd.com and tag:inbox -notmuchcmd tag +github +filed \(folder:".GitHub" or from:github.com\) and tag:inbox -notmuchcmd tag -filed '(to:workflows@vger.kernel.org)' and tag:inbox - -notmuchcmd tag -filed +lightning +lightning-dev +list to:lightning-dev -notmuchcmd tag -filed +lightning +clightning +list to:"c-lightning@lists.ozlabs.org" and tag:inbox -notmuchcmd tag +lightning +clightning '(to:"ElementsProject/lightning" or to:"lightningd/plugins")' and tag:inbox - -notmuchcmd tag +nix-dev +nix +list \(to:nix-dev@lists.science.uu.nl OR to:nix-dev@cs.uu.nl OR to:nix-devel@googlegroups.com OR from:nixos1@discoursemail.com\) and tag:inbox -notmuchcmd tag +redo +list to:redo-list.googlegroups.com and tag:inbox - -# file busy -notmuchcmd tag +filed tag:busy and not tag:filed and not tag:best and not tag:flagged and tag:inbox - -# more contracting stuff -notmuchcmd tag +work +steamoji tag:inbox and to:steamoji -notmuchcmd tag +alert to:notifications.heroku.com - -notmuchcmd tag +work +commit -filed tag:inbox and to:will.casarin@commit.dev -notmuchcmd tag +work +commit tag:github and tag:inbox and to:commitdev +#notmuchcmd tag +to-me not tag:to-me and and tag:inbox and \(to:jackbox55@gmail.com or to:jb55@jb55.com\) +#notmuchcmd tag +flagged tag:inbox and not tag:flagged and to:jackbox55+star@gmail.com # except if someone mentions e -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)' +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:ci_activity@noreply.github.com or to:review_requested@noreply.github.com or to:comment@noreply.github.com or (subject:jb55 and tag:github) or ((usdt or ebpf or bpf or tracepoints) and bitcoin)' + +# don't really need this in my inbox +notmuchcmd tag +filed to:push@noreply.github.com # spam -notmuchcmd tag +spam -inbox 'from:"BOOM OF SALES"' and tag:inbox +notmuchcmd tag -inbox from:Giveaway or 'from:"BOOM OF SALES"' or 'from:Ray Ban' or from:.lat or from:163.com or from:.homes or from:.bio or from:.biz or from:.world or from:.boats or from:.bond or from:.cfd or from:.xyz or from:.pro or from:.beauty or from:.fun or from:.shop or from:.yeah.net or from:.sbs or from:.one or from:.bet or from:.best or from:.info or from:.online or from:.ltd or from:.live or from:.club or from:.life or from:.top or from:126.com or from:.wiki or from:.monster or from:.ru or from:.mom or from:.us or from:.click or from:.today or from:.autos or from:.co or from:.buzz or from:.quest or 'from:Home Depot' or from:resistthemainstream.com or from:sugarmat or 'from:Malware Alert' or 'from:Lowes' or from:IServiced and tag:inbox # not spam notmuchcmd tag +inbox -spam +flagged "bitcoin wizard" and tag:spam @@ -84,7 +30,4 @@ 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/bin/perln b/bin/perln @@ -1,2 +1,2 @@ -/bin/sh +#!/bin/sh perl -n "$@" diff --git a/bin/relayer b/bin/relayer @@ -6,7 +6,7 @@ printf "using post '%s'\n" "$POST" >&2 for relay in $(cat ~/dotfiles/relays) do - <<<"$POST" jq -c '["EVENT", .]' | websocat "$relay" & + <<<"$POST" websocat "$relay" & done wait diff --git a/dotfiles/.bashrc b/dotfiles/.bashrc @@ -28,15 +28,18 @@ 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 HISTSIZE=50000 #export HISTCONTROL=ignoredups # ... and ignore same sucessive entries. export HISTCONTROL=ignoreboth:erasedups +export HISTSIZE=50000 # check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. shopt -s checkwinsize +# OMG +shopt -s histappend + DIRCOLORS="$HOME/.dircolors" UNDISTRACT="$HOME/dotfiles/bash-undistract-me/undistract-me.sh" @@ -69,8 +72,8 @@ export GOPHERCLIENT=vf1 export GEMINICLIENT=av98 export GOPHER=$GOPHERCLIENT export GNUPGHOME="$HOME/.gnupg" -export SHAREFILE_HOST='charon:public/s/' -export SHAREFILE_URL='https://jb55.com/s/' +export SHAREFILE_HOST='charon:/www/cdn.jb55.com/s/' +export SHAREFILE_URL='https://cdn.jb55.com/s/' export SHARE_SS_DIR="$HOME/var/img/ss" export DOTFILES=${DOTFILES:-$HOME/dotfiles} export VI_MODE=1 @@ -98,7 +101,7 @@ md () { mandown README* } -function run_fuzzer() { +function f() { eval "$(fuzz-run-command "$@")" } @@ -116,7 +119,7 @@ alias e="edit -n" alias emacs="env TERM=xterm-256color emacs" alias feh="feh --conversion-timeout 2" alias fixssh="source $HOME/bin/fixssh" -alias f=run_fuzzer +#alias f=run_fuzzer alias fzf="fzf --exact" alias g=git 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'" @@ -310,10 +313,12 @@ bind '"\C-x\C-e": shell-expand-line' bind '"\C-x\C-r": redraw-current-line' 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 '"\C-f": "`fuzz-run-command`\C-x\C-e"' bind -m vi-command '"\C-f": "i\C-f"' -bind '"\C-g": "\C-x\C-addi`fuzz-run-command sh`\C-x\C-e\C-x^\C-x\C-a$a\C-x\C-r"' +bind '"\C-g": "`fuzz-run-command sh`\C-x\C-e"' bind -m vi-command '"\C-h": "i\C-h"' +bind '"\C-e": "!!\C-x\C-e"' +bind -m vi-command '"\C-e": "i\C-e"' bind '"\C-l":clear-screen' diff --git a/dotfiles/.config/neomutt/neomuttrc b/dotfiles/.config/neomutt/neomuttrc @@ -3,6 +3,7 @@ set nm_default_uri="notmuch:///home/jb55/mail/personal" set sendmail="/home/jb55/bin/sendmail-mutt" set virtual_spoolfile=yes set folder="/home/jb55/mail/personal" +set beep=no set wait_key=no set pager_stop=yes set from="jb55@jb55.com" @@ -10,7 +11,7 @@ set pipe_decode=yes set sig_dashes=no set pipe_split=no set envelope_from=yes -set mime_forward=no +set mime_forward=yes unset markers set text_flowed @@ -45,7 +46,7 @@ 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|less<enter>" +#macro pager c "|cols|less<enter>" macro pager t "|collapse|less<enter>" macro attach o "<save-entry><enter>open %s<enter>" diff --git a/dotfiles/.config/qutebrowser/config.py b/dotfiles/.config/qutebrowser/config.py @@ -93,6 +93,7 @@ config.set('tabs.select_on_remove', 'last-used') 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('url.searchengines', { diff --git a/dotfiles/.gitconfig b/dotfiles/.gitconfig @@ -6,12 +6,15 @@ diff = auto status = auto [core] + abbrev = 12 excludesfile = /Users/jb55/.gitignore_global editor = edit - pager = delta --max-line-length=4096 --file-style=box --paging=always + pager = delta --paging=always [sendemail] smtpServer=/home/jb55/bin/sendmail - ccCmd = git-contacts + ccCmd = git-contacts + aliasesFile= ~/.mail_aliases + aliasFileType=mutt [url "git@github.com:"] insteadOf = gh: [url "git@git.sr.ht:~"] @@ -36,6 +39,7 @@ dft = difftool s = show a = add + amw = am --whitespace=fix ap = add -p b = branch au = add -u @@ -78,11 +82,14 @@ tg = log --date-order --tags --simplify-by-decoration --pretty=format:'%ai %h %d' try = merge --no-commit --no-ff co = checkout + chp = cherry-pick sw = switch - fixes = !git --no-pager show -s --pretty='format:Fixes: %h (\"%s\")\n' + fixes = !git --no-pager show -s --pretty=fixes pushall = !git remote | parallel -L1 -I R git push R master [rebase] autosquash = true +[pretty] + fixes = Fixes: %h (\"%s\") [diff] colorMoved = dimmed-zebra colorMovedWs = allow-indentation-change @@ -96,7 +103,6 @@ [magit] hideCampaign = true [nostr] - relays = wss://relay.damus.io wss://nos.lol wss://nostr.wine [github] user = jb55 [grep] @@ -113,6 +119,8 @@ difftool = true [diff] tool = difftastic +[nostr] + relays = wss://relay.damus.io wss://nos.lol wss://nostr.wine [filter "lfs"] clean = git-lfs clean -- %f smudge = git-lfs smudge -- %f diff --git a/dotfiles/.mail_aliases b/dotfiles/.mail_aliases @@ -4,8 +4,19 @@ alias matt Matt Richards <matt.richards@steamoji.com> alias mikhail Mikhail Baiman <mikhail.baiman@steamoji.com> alias alex Alex Chunn <alex.chunn@steamoji.com> alias jesse Jesse Brydle <jesse.brydle@steamoji.com> -alias v Vanessa Gray <vanessagray31@gmail.com> +alias v Vanessa Gray <vanessa@damus.io> alias steam William Casarin <will.casarin@steamoji.com> alias rusty Rusty Russell <rusty@rustcorp.com.au> +alias elsat Elsat <sembene_truestar@simplelogin.com> +alias terry Terry Yiu <terryyiu@gmail.com> +alias montz Bryan Montz <bryanmontz@me.com> +alias ben Ben Weeks <Ben.Weeks@KnowAll.ai> +alias nostr-w3c public-nostr@w3.org +alias nostr-google nostr-protocol@googlegroups.com +alias cr0bar <cr0bar@cr0.bar> +alias suhail Suhail Saqan <suhail.saqan@gmail.com> +alias daniel Daniel D'Aquino <daniel@daquino.me> alias managers Kitsilano <kitsilano@steamoji.com>, Kerrisdale <kerrisdale@steamoji.com>, West Vancouver <westvancouver@steamoji.com> + +alias damus Bryan Montz <bryanmontz@me.com>, Terry Yiu <terryyiu@gmail.com>, Joel Klabo <joelklabo@gmail.com>, Ben Weeks <Ben.Weeks@KnowAll.ai>, ericholguin <eric.holguinsanchez@gmail.com>, Swift <scoder1747@gmail.com> diff --git a/dotfiles/.xmonad/xmonad.hs b/dotfiles/.xmonad/xmonad.hs @@ -9,7 +9,7 @@ import Data.Ratio import Data.IORef import Data.List -import Data.Default (def) +--import Data.Default (def) import Control.Monad (when) import System.IO.Unsafe (unsafePerformIO) import System.Posix.Files (readSymbolicLink) @@ -35,7 +35,7 @@ import XMonad.Layout.NoBorders import XMonad.Layout.ResizableTile import XMonad.Layout.ResizeScreen import XMonad.Layout.Spacing -import XMonad.Layout.Spiral +import XMonad.Layout.Spiral as S import XMonad.Layout.Tabbed import XMonad.Layout.ToggleLayouts (ToggleLayout(ToggleLayout)) import XMonad.Prompt @@ -152,7 +152,7 @@ baseLayout = let tall = ResizableTall 1 (3/100) (1/2) [] in - Mirror tall -- ||| otherstuff + Mirror tall ||| S.spiral (4/3) --S.spiralWithDir S.South S.CW (4/3) layout theme = smartBorders diff --git a/dotfiles/commands b/dotfiles/commands @@ -1,3 +1,5 @@ +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 afb app > feeds > blogs fuzz-rss "grep @blog | grep -v @busy" @@ -25,6 +27,7 @@ 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 eFc edit fuzz command fuzz-edit-command @@ -41,6 +44,7 @@ gb git branches echo git bvr G gemini gemmark 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 @@ -60,6 +64,7 @@ nT email today echo f nt query:today 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 @@ -78,7 +83,6 @@ 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 -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 ' @@ -89,4 +93,6 @@ 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/relays.txt b/dotfiles/relays.txt @@ -0,0 +1,2 @@ +wss://nostr-pub.wellorder.net +wss://relay.damus.io diff --git a/dotfiles/rssfeeds b/dotfiles/rssfeeds @@ -39,3 +39,5 @@ scott-aaronson @blog @physics https://scottaaronson.blog/?feed=rss2 dietterich-labs @yt https://www.youtube.com/feeds/videos.xml?channel_id=UCd02pSRrecAVFOPjB-bfv-Q allen-farrington @blog https://medium.com/feed/@allenfarrington woit @blog https://www.math.columbia.edu/~woit/wordpress/?feed=rss2 +stabilityai @blog @ai https://stability.ai/blog?format=rss +algorithmic-bridge @blog @ai https://thealgorithmicbridge.substack.com/feed diff --git a/nix-config/configuration.nix b/nix-config/configuration.nix @@ -5,7 +5,7 @@ { config, pkgs, ... }: let machine = extra.private.machine; - isDesktop = machine != "charon"; + isDesktop = machine != "purple"; machinePath = p: let m = "/" + machine; in ./machines + m + p; machineConfig = import (machinePath "/config") pkgs; diff --git a/nix-config/environment/default.nix b/nix-config/environment/default.nix @@ -8,19 +8,18 @@ let jb55pkgs = import <jb55pkgs> { inherit pkgs; }; sha256 = "0xd86s2smjvlc7rlb6rkgx2hj3c3sbcz3gs8rf93x69jqdvwb6rr"; }) {}; myPackages = with jb55pkgs; [ - rsslink - nostril - bcalc - btcs - csv-delim - csv-scripts - extname - mandown - ratio - samp - sharefile - zebra - define + #rsslink + #bcalc + #btcs + #csv-delim + #csv-scripts + #extname + #mandown + #ratio + #samp + #sharefile + #zebra + #define #nixpkgs-ml-tools ]; @@ -35,9 +34,11 @@ let jb55pkgs = import <jb55pkgs> { inherit pkgs; }; tut python3Packages.num2words - #python3Packages.howdoi + python3Packages.howdoi tree + xsv datefmt + #nostril nncp asciinema aspell diff --git a/nix-config/machines/monad/networking/default.nix b/nix-config/machines/monad/networking/default.nix @@ -116,6 +116,9 @@ in allowedIPs = [ "10.100.0.7/32" ]; endpoint = "45.79.91.128:51820"; } + { publicKey = "fj35gCObJ+uP/8tDpYsAD+b2XuSpa82umL/8LscIHwQ="; # pixel + allowedIPs = [ "10.100.0.9/32" ]; + } { publicKey = "oYTNuXPl5GQsz53cL55MO9MfI61DyZBrBDy9ZFBpDWU="; # cross (air) allowedIPs = [ "10.100.0.8/32" ]; } diff --git a/nix-config/machines/purple/config/default.nix b/nix-config/machines/purple/config/default.nix @@ -0,0 +1 @@ +pkgs: {} diff --git a/nix-config/machines/purple/default.nix b/nix-config/machines/purple/default.nix @@ -0,0 +1,26 @@ +extra: +{ config, lib, pkgs, ... }: { + imports = [ + ./hardware + ./networking + (import ./nginx extra) + #(import ./sheetzen extra) + #(import ./vidstats extra) + ]; + + users.extraUsers.purple = { + name = "purple"; + isNormalUser = true; + group = "users"; + uid = 1001; + extraGroups = [ "wheel" "dialout" ]; + home = "/home/purple"; + createHome = true; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGNLTLt7dwKwq7guDG5GYJBG+5x8SFTi06upWvxE7Cyy danielnogueira@Daniels-MacBook-Pro.local" + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDKMkKFzVDAXG+0sz1UjXgJHmh1+EE7dJ9WUJF14uAfFRv1SGUsohddvguxjrfbo1isen6sptDioJkeffcBCnYC88xvVWt/DRL4L8QV2NUUgv0SFCDCYOAaQ92pAv1J0WbSbI5hD0MZG5GQAA9dX8lLaxBX6nnByvrUFbvXusMrrywSNbm0nHXZD/y49WiZn5Hh9bMbviNLVNXMlUxzjQmY6rf+cxunAEQrXv3kD8aHb4p4+qGYCTpI17+tKogYet5Rg/VW4yg6LonpEfOlwTG50uIYoBE/peCs5xKUShQCs8UQGE/NEYjqaR9wt+tM74xoKECLLweyP8jxhrK+VTHn jb55@quiver" + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDdB7XdA4MupSTIRsv1y4OMiXPBZn+DasePrA57k4EVigAfB0Lv5vW7Y2QHvqGKP9vBtIVEMhsgMuIQxXaS7JzibzXvjuC82jZVsd6BuS+Msz5WbZREVzGSEM8RMDCS19gR3s8nwW6Y6FkFmhmqgNqLVM8ular+3ThPEAW56s9tJ9LyWJ/mymNQ5XuNBajx3rOmy0j+uBbrkaZHs33P6R367lhspywtKK9uzfOaIAWlcFHgx/D7ahR1vq+jALniADU0cNqJNWlD4hshM2+03WtmIHIMIvmST1iKIs/uvitBqeY/h2fuxfRfcDXtByR6t1MqJOvUI3Z2sBi1PZsCNMenPWXN3W50HoKwRLOeoN3e/LKUX2LaNS7KqAczx7Nf6eJf1I1quq5FLN3pabfU/ulkYG8IK29FfLwW0ljEUOBO412AG9e1dhvnxRICHqBuHHJHUEqXsE1pg8G3NXCqrJ/rg8Kig81dmRlMlc06uOeRLWfX4/N0zP0DP7qOeY69zTc= jb55@nostrich" + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCgRmgFPb8TA9NAeh9zBg6xZLniaML3ZNI9IMTNX8SIEux4MIhvyzJOCQOGj3P7lTJQRDBL0Hv8s24Krr55EZQQwRk+glNC3/B4JI8W9wmNzhm3d1UnEPgsCZ4M8ryc+5CIEMEuqmlqiqaU1EsLIf7fMO9AmNzV+hrnBc/Vsg8ko+5cKsgb/XX7awbGbR88F2FbpSYrmYQLG6/PnjqA0lORPNl2FcOfvc5VUPxoeiqASJF++awqPUeWGHKgAhi7vATWxqNL3N91Xsn2qWLgtYar4HTzp0LpzrybLikaed2f/dTM4utoeygcGnzU4zKeT7rc7S7gtY8irOl09VRpM66h jb55@monad" + ]; + }; +} diff --git a/nix-config/machines/purple/hardware/default.nix b/nix-config/machines/purple/hardware/default.nix @@ -0,0 +1,40 @@ +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.kernelParams = [ "console=ttyS0,19200n8" ]; + boot.extraModulePackages = [ ]; + boot.loader.grub.extraConfig = '' + serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1; + terminal_input serial; + terminal_output serial + ''; + + boot.loader.grub.forceInstall = true; + boot.loader.grub.device = "nodev"; + boot.loader.timeout = 10; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/1e609a52-89b2-434d-8062-68e4c957e01a"; + fsType = "ext4"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/f1408ea6-59a0-11ed-bc9d-525400000001"; } + ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s5.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/nix-config/machines/purple/networking/default.nix b/nix-config/machines/purple/networking/default.nix @@ -0,0 +1,22 @@ +{ config, lib, pkgs, ... }: +let + openTCP = dev: port: '' + ip46tables -A nixos-fw -i ${dev} -p tcp --dport ${toString port} -j nixos-fw-accept + ''; + ports = { + test_http = 3000; + }; +in +{ + services.openssh.gatewayPorts = "yes"; + + networking.enableIPv6 = false; + networking.firewall.allowedTCPPorts = with ports; [ 22 443 80 test_http ]; + + networking.domain = "damus.io"; + networking.search = [ "damus.io" ]; + networking.extraHosts = '' + 127.0.0.1 damus.io + ::1 damus.io + ''; +} diff --git a/nix-config/machines/purple/nginx/default.nix b/nix-config/machines/purple/nginx/default.nix @@ -0,0 +1,198 @@ +extra: +{ config, lib, pkgs, ... }: +let logDir = "/var/log/nginx"; + + damus-api = (import (pkgs.fetchFromGitHub { + owner = "damus-io"; + repo = "api"; + rev = "68a4aafbf284ec2281e1a842177c8fd1386586c1"; + sha256 = "sha256-fxDrV2J8DtwVlU9hq2DRkQGLrarJMh3VxifouQeryEU="; + }) {}).package; + + damus-api-port = 4000; + damus-api-staging-port = 4001; + damus-api-service = {env, port, db}: { + description = "damus-api-${env}"; + wantedBy = [ "multi-user.target" ]; + serviceConfig.Type = "simple"; + serviceConfig.ExecStart = "${damus-api}/bin/damus-api"; + + environment = { + PORT="${toString port}"; + DEEPL_KEY=extra.private.deepl_key; + LN_NODE_ID=extra.private.ln_node_id; + LN_NODE_ADDRESS=extra.private.ln_node_address; + LN_RUNE=extra.private.ln_rune; + LN_WS_PROXY=extra.private.ln_ws_proxy; + DB_PATH=db; + }; + }; +in { + systemd.services.damus-api-staging = damus-api-service { + env = "staging"; + port = damus-api-staging-port; + db = "/home/purple/api/staging"; + }; + + systemd.services.damus-api = damus-api-service { + env = "production"; + port = damus-api-port; + db = "/home/purple/api/production"; + }; + + services.nginx = { + enable = true; + + config = '' + worker_processes 2; + + events { + worker_connections 768; + # multi_accept on; + } + ''; + + httpConfig = '' + port_in_redirect off; + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; + ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA'; + ssl_prefer_server_ciphers on; + + # HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months) + add_header Strict-Transport-Security max-age=15768000; + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + # server_tokens off; + proxy_buffering off; + proxy_read_timeout 300s; + expires off; + + access_log ${logDir}/access.log; + error_log ${logDir}/error.log; + + gzip on; + gzip_disable "msie6"; + + server { + listen 80 default_server; + server_name ""; + return 444; + } + + server { + listen 80; + + server_name api.damus.io; + + location / { + proxy_pass http://localhost:${toString damus-api-port}; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } + } + + server { + listen 80; + + server_name api.staging.damus.io; + + location / { + proxy_pass http://localhost:${toString damus-api-staging-port}; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } + } + + server { + listen 80; + + server_name damus.io; + + location / { + autoindex on; + root /www/damus.io; + + add_header 'Access-Control-Allow-Origin' '*' always; + add_header 'Access-Control-Expose-Headers' 'Content-Length' always; + } + + location ~* "^/(?<note>note1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]+)(?<end>.png)?/?$" { + proxy_pass http://localhost:3000; + } + + location ~* "^/(?<nevent>nevent1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]+)(?<end>.png)?/?$" { + proxy_pass http://localhost:3000; + } + + location ~* "^/(?<pk>npub1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]+)(?<end>.png)?/?$" { + proxy_pass http://localhost:3000; + } + + location ~* "^/(?<pk>nprofile1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]+)(?<end>.png)?/?$" { + proxy_pass http://localhost:3000; + } + + location /github-hook { + proxy_pass http://localhost:3111; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } + + location /appstore { + return 301 https://apps.apple.com/us/app/damus/id1628663131; + } + + location /devchat { + return 301 https://t.me/+abMSAEO6ho8xYjdh; + } + + location /testflight { + return 301 https://testflight.apple.com/join/CLwjLxWl; + } + + location /code { + return 301 https://github.com/damus-io/damus/pulls; + } + + location /list/patches { + return 301 https://groups.google.com/a/damus.io/g/patches; + } + + location /list/product { + return 301 https://groups.google.com/a/damus.io/g/product; + } + + location /list/design { + return 301 https://groups.google.com/a/damus.io/g/design; + } + + location /list/dev { + return 301 https://groups.google.com/a/damus.io/g/dev; + } + + location /figma { + return 301 https://www.figma.com/file/ORaT1T0Ywfbm0sIjwy5Rgq/Damus-iOS?type=design&node-id=0-1&t=AGpDcKb6rHfpQ9CA-0; + } + + location /merch/hat { + return 302 http://lnlink.org/?d=ASED88EIzNU2uFJoQfClxYISu55lhKHrSTCA58HMNPgtrXECMjQuODQuMTUyLjE4Nzo4MzI0AANgB6Cj2QCeZAFOZ1nS6qGuRe4Vf6qzwJyQ5Qo3b0HRt_w9MTIwJm1ldGhvZD1pbnZvaWNlfG1ldGhvZD13YWl0aW52b2ljZSZwbmFtZWxhYmVsXmxubGluay0mcmF0ZT04BERhbXVzIEhhdAAFAALG8AZUaGFua3MgZm9yIHN1cHBvcnRpbmcgRGFtdXMhAA==; + } + + location /merch { + return 302 http://lnlink.org/?d=ASED88EIzNU2uFJoQfClxYISu55lhKHrSTCA58HMNPgtrXECMjQuODQuMTUyLjE4Nzo4MzI0AANgB6Cj2QCeZAFOZ1nS6qGuRe4Vf6qzwJyQ5Qo3b0HRt_w9MTIwJm1ldGhvZD1pbnZvaWNlfG1ldGhvZD13YWl0aW52b2ljZSZwbmFtZWxhYmVsXmxubGluay0mcmF0ZT04BERhbXVzIE1lcmNoAAUAAfvQBlRoYW5rcyBmb3Igc3VwcG9ydGluZyBkYW11cyEA; + } + } + + server { + listen 80; + listen [::]:80; + + server_name www.damus.io; + return 301 https://damus.io$request_uri; + } + ''; + }; +} diff --git a/nix-config/machines/quiver/default.nix b/nix-config/machines/quiver/default.nix @@ -17,6 +17,8 @@ extra: documentation.nixos.enable = false; + programs.adb.enable = true; + boot.kernelPackages = pkgs.linuxPackages_latest; boot.extraModprobeConfig = '' diff --git a/nix-config/nixpkgs/config.nix b/nix-config/nixpkgs/config.nix @@ -11,10 +11,11 @@ let #monstercatPkgs = import <monstercatpkgs> { inherit pkgs; }; in { allowUnfree = true; allowUnfreeRedistributable = true; + android_sdk.accept_license = true; allowBroken = false; checkMeta = true; zathura.useMupdf = true; - android_sdk.accept_license = true; + #android_sdk.accept_license = true; packageOverrides = super: rec { qemu = super.qemu.override { diff --git a/nix-config/services/desktop/default.nix b/nix-config/services/desktop/default.nix @@ -56,7 +56,7 @@ in services.redshift = { enable = if extra.is-minimal then false else true; temperature.day = 5500; - temperature.night = 4300; + temperature.night = 3800; brightness = { day = "1.0"; @@ -190,7 +190,7 @@ in wantedBy = [ "graphical-session.target" ]; after = [ "graphical-session.target" ]; serviceConfig.ExecStart = "${pkgs.libnotify}/bin/notify-send -u critical standup"; - startAt = "Mon..Fri *-*-* 8:58:00"; + startAt = "Mon..Fri *-*-* 15:58:00"; }; systemd.user.services.urxvtd = {