citadel

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

commit 16c9c50267e3d941054efc7bf37c665359909de9
parent 1018b71c4cc57ed4f65454efaa6cfc9c98417bef
Author: William Casarin <jb55@jb55.com>
Date:   Fri, 17 Nov 2023 06:32:09 -0800

monad updates

Diffstat:
Mbin/browser | 2+-
Mbin/btc-balance | 10++++++++--
Mbin/fuzz-notmuch-am | 2+-
Mbin/mail-prpatch-insert | 22+++++++++++++++++-----
Mbin/mutt-local-date | 2+-
Mdotfiles/.config/neomutt/neomuttrc | 16++++++++--------
Mdotfiles/.config/nvim/init.vim | 3++-
Mdotfiles/.config/qutebrowser/autoconfig.yml | 6+++---
Mdotfiles/.gitconfig | 2+-
Mnix-config/environment/desktop/default.nix | 1+
Mnix-config/machines/charon/networking/default.nix | 3++-
Mnix-config/machines/monad/default.nix | 37++++++++++++++++++++-----------------
Mnix-config/machines/monad/hardware/default.nix | 24++++++++++++------------
Mnix-config/machines/monad/networking/default.nix | 20+++++++++++---------
Mnix-config/machines/quiver/default.nix | 2+-
Mnix-config/nixpkgs/config.nix | 18+++++++++---------
Mnix-config/services/default.nix | 4++--
17 files changed, 100 insertions(+), 74 deletions(-)

diff --git a/bin/browser b/bin/browser @@ -5,7 +5,7 @@ set -e #BROWSER=chromium BROWSER=qutebrowser -BROWSER_ARGS="--enable-webengine-inspector" +#BROWSER_ARGS="--enable-webengine-inspector" export EDITOR=/home/jb55/bin/edit-gui kill_browser () { diff --git a/bin/btc-balance b/bin/btc-balance @@ -1,14 +1,20 @@ #!/usr/bin/env bash #btc coins | awk '{print $3}' | xargs printf '%.8f * 100000000\n' | bc -l | xargs printf '%.0f\n' | paste -sd+ | bc -l | xargs printf '%s sats to btc\n' | bcalc -n +set -e + for wallet in personal vanessa multisig bare clightning do echo -n "$wallet " bcli -rpcwallet="$wallet" getbalance done -echo -n "cln-availout " -lcli summary | grep avail_out | cut -d= -f2 | cut -d" " -f1 | xargs printf '%s to btc\n' | bcalc -n +summary=$(lcli summary) +if [ -n "$summary" ] +then + echo -n "cln-availout " + <<<"$summary" grep avail_out | cut -d= -f2 | cut -d" " -f1 | xargs printf '%s to btc\n' | bcalc -n +fi #if [ -n "$1" ]; then # FIAT=$(printf '%s sats to fiat\n' "$SATS" | bcalc --price "$1") 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:-query:patches} +notmuch am -s --am -f ${1:-'tag:inbox and subject:PATCH'} diff --git a/bin/mail-prpatch-insert b/bin/mail-prpatch-insert @@ -3,7 +3,7 @@ set -e function new_msgid() { - echo "<$(sha256sum "$file" | awk '{ print $1 }')-$(date +%s)>" + echo "<$(sha256sum "$1" | awk '{ print $1 }')-$(date +%s)>" } TO="jb55@jb55.com" @@ -11,6 +11,13 @@ PRPATCH="$HOME/var/prpatch" MBOX="$PRPATCH/out.mbox" PATCHES="$PRPATCH/out" +function build_coverletter() { + <"$1" awk '/^$/ {exit} {print}' > "$PRPATCH"/header + <"$PRPATCH/mail" awk 'BEGIN {print_it=0;} skip > 0 {skip -= 1; next;} /^----==_mimepart/ {print_it=!print_it;skip=3;next;} print_it==1 {print;}' | + cat "$PRPATCH/header" - | + sed -E 's,(PATCH[^1]+)1,\10,' > "$PATCHES/0000" +} + rm -rf "$PRPATCH" mkdir -p "$PATCHES" mail="$(cat -)" @@ -22,13 +29,14 @@ replyto="$(grep -i '^reply-to:' <<<"$mail" | cut -d":" -f2- | tr -d '\n' || :)" echo "$mail" > "$PRPATCH/mail" <<<"$mail" mail-prpatch > "$MBOX" -#sed -i"" '/^Subject:/ {N; s/\n / /}' "$MBOX" +# pull out the cover letter git mailsplit -o"$PATCHES" "$MBOX" -file="$PATCHES"/0001 +$(build_coverletter "$PATCHES/0001") -msgid=$(new_msgid) +file="$PATCHES"/0000 +msgid=$(new_msgid "$file") threadid=$msgid for file in "$PATCHES/"* do @@ -53,6 +61,10 @@ do sed -i"" "s,\[PATCH,\[PATCH $target," "$file" fi + if [[ "$prlink" =~ "damus-io" ]]; then + TO="patches@damus.io" + fi + sed -i"" "1 a To: $TO" "$file" sed -i"" "1 a Message-ID: $msgid" "$file" @@ -62,5 +74,5 @@ do notmuch insert +inbox < "$file" - msgid=$(new_msgid) + msgid=$(new_msgid "$file") done diff --git a/bin/mutt-local-date b/bin/mutt-local-date @@ -1,4 +1,4 @@ -#!/usr/bin/perl -n +#!/home/jb55/bin/perln use Date::Parse; use POSIX; diff --git a/dotfiles/.config/neomutt/neomuttrc b/dotfiles/.config/neomutt/neomuttrc @@ -33,12 +33,12 @@ virtual-mailboxes \ "damus-prs" "notmuch://?query=query:damusp" \ "damus-issues" "notmuch://?query=query:damusi" -macro index,pager a "<modify-labels>-unread -inbox<enter> -macro index,pager i "<modify-labels>+inbox<enter> +macro index,pager a "<modify-labels-then-hide>-unread -inbox<enter>" +macro index,pager i "<modify-labels>+inbox<enter>" macro index,pager A "<create-alias>" "Create alias" -macro index,pager F "<modify-labels>+filed" "File message" +macro index,pager F "<modify-labels-then-hide>+filed" "File message" macro index,pager + "<modify-labels>+" -macro index,pager S "<modify-labels>+spam -unread -inbox<enter> +macro index,pager S "<modify-labels-then-hide>+spam -unread -inbox<enter>" macro index c "<change-vfolder>?" "Change to vfolder overview" macro index \\\\ "<vfolder-from-query>" "Search mailbox" macro pager p "|delta --paging always<enter>" @@ -67,9 +67,9 @@ color quoted9 blue default # Quoting Ebene 10 color header brightcyan default '^Subject:' #collapse threads -folder-hook . "push \eV" -set collapse_unread=yes -set uncollapse_jump=yes -set display_filter=~/bin/mutt-local-date +#folder-hook . "push \eV" +#set collapse_unread=yes +#set uncollapse_jump=yes +#set display_filter=~/bin/mutt-local-date source ~/.mail_aliases diff --git a/dotfiles/.config/nvim/init.vim b/dotfiles/.config/nvim/init.vim @@ -11,7 +11,8 @@ set hidden set rnu nu set wrap -hi ColorColumn ctermbg=8 +hi ColorColumn ctermbg=254 +hi StatusLine ctermbg=254 map Y y$ diff --git a/dotfiles/.config/qutebrowser/autoconfig.yml b/dotfiles/.config/qutebrowser/autoconfig.yml @@ -1,10 +1,10 @@ # If a config.py file exists, this file is ignored unless it's explicitly loaded # via config.load_autoconfig(). For more information, see: -# https://github.com/qutebrowser/qutebrowser/blob/master/doc/help/configuring.asciidoc#loading-autoconfigyml +# https://github.com/qutebrowser/qutebrowser/blob/main/doc/help/configuring.asciidoc#loading-autoconfigyml # DO NOT edit this file by hand, qutebrowser will overwrite it. # Instead, create a config.py - see :help for details. config_version: 2 settings: - content.notifications.enabled: - https://www.tiktok.com: false + colors.webpage.darkmode.enabled: + global: true diff --git a/dotfiles/.gitconfig b/dotfiles/.gitconfig @@ -78,7 +78,7 @@ co = checkout sw = switch fixes = !git --no-pager show -s --pretty='format:Fixes: %h (\"%s\")\n' - pushall = !git remote | parallel -L1 -I R git push R master + pushall = !git remote | parallel -L1 -I R git push R master [rebase] autosquash = true [diff] diff --git a/nix-config/environment/desktop/default.nix b/nix-config/environment/desktop/default.nix @@ -119,6 +119,7 @@ in { }; programs.steam.enable = true; + programs.gamemode.enable = true; environment.systemPackages = if extra.is-minimal then (with pkgs; [ #steam diff --git a/nix-config/machines/charon/networking/default.nix b/nix-config/machines/charon/networking/default.nix @@ -6,12 +6,13 @@ let ports = { git = 9418; gemini = 1965; + starbound = 21025; }; in { services.openssh.gatewayPorts = "yes"; - networking.firewall.allowedTCPPorts = with ports; [ 22 443 80 70 12566 12788 5222 5269 3415 git gemini ]; + networking.firewall.allowedTCPPorts = with ports; [ 22 443 80 70 12566 12788 5222 5269 3415 git gemini starbound ]; networking.domain = "jb55.com"; networking.search = [ "jb55.com" ]; diff --git a/nix-config/machines/monad/default.nix b/nix-config/machines/monad/default.nix @@ -33,12 +33,14 @@ in #(import ../../misc/dnsmasq-adblock.nix) (import ../../misc/msmtp extra) (import ./networking extra) - #(import ../../misc/imap-notifier extra) + (import ../../misc/imap-notifier extra) ] ++ (if !extra.is-minimal then [ (import ./bitcoin extra) ] else []); #hardware.steam-hardware.enable = true; - #boot.kernelPackages = pkgs.linuxPackages_latest; + boot.zfs.enableUnstable = true; + boot.zfs.removeLinuxDRM = true; + boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; services.ofono.enable = false; services.ofono.plugins = with pkgs; [ ofono-phonesim ]; @@ -110,6 +112,7 @@ in 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.bitlbee.plugins = with pkgs; [ bitlbee-mastodon @@ -219,20 +222,20 @@ 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; + #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" + # ] + #''; systemd.user.services.btc-ban-aws = { enable = if extra.is-minimal then false else true; @@ -251,7 +254,7 @@ in environment.systemPackages = [ pkgs.virt-manager ]; - services.minecraft-server.enable = true; + services.minecraft-server.enable = false; services.minecraft-server.eula = true; services.minecraft-server.openFirewall = true; services.minecraft-server.declarative = true; diff --git a/nix-config/machines/monad/hardware/default.nix b/nix-config/machines/monad/hardware/default.nix @@ -2,13 +2,13 @@ { boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "sd_mod" "amdgpu" "vfio-pci" ]; - boot.initrd.preDeviceCommands = '' - DEVS="0000:27:00.0 0000:27:00.1" - for DEV in $DEVS; do - echo "vfio-pci" > /sys/bus/pci/devices/$DEV/driver_override - done - modprobe -i vfio-pci - ''; + #boot.initrd.preDeviceCommands = '' + # DEVS="0000:27:00.0 0000:27:00.1" + # for DEV in $DEVS; do + # echo "vfio-pci" > /sys/bus/pci/devices/$DEV/driver_override + # done + # modprobe -i vfio-pci + #''; boot.kernelParams = [ "amdgpu.gpu_recovery=1" ]; boot.kernelModules = [ "kvm-amd" "kvm-intel" ]; @@ -25,16 +25,16 @@ fsType = "zfs"; }; - #fileSystems."/chonk" = - # { device = "chonk"; - # fsType = "zfs"; - # }; - fileSystems."/zbig" = { device = "zbig"; fsType = "zfs"; }; + #fileSystems."/chonk" = + # { device = "chonk"; + # 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 @@ -31,34 +31,36 @@ let ports = { lightning = 9735; lightningt = 9736; - lightning_websocket = 8756; + lightning_websocket = 8324; lntun = 7878; dns = 53; http = 80; wireguard = 51820; weechat = 9000; nncp = 5442; + starbound = 21025; inherit (extra.private) notify-port; }; - firewallRules = [ - "nixos-fw -s 10.100.0.0/24,192.168.87.1/24 -p tcp --dport 8080 -j nixos-fw-accept" # dev - "nixos-fw -s 10.100.0.0/24,192.168.87.1/24 -p tcp --dport 5442 -j nixos-fw-accept" + 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 -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 ports.lntun} -j nixos-fw-accept" - "nixos-fw -s 10.100.0.0/24 -p tcp --dport ${toString ports.weechat} -j nixos-fw-accept" - "nixos-fw -s 10.100.0.0/24,192.168.87.1/24 -p tcp --dport 8333 -j nixos-fw-accept" # bitcoin - "nixos-fw -s 10.100.0.0/24,192.168.87.1/24 -p tcp --dport 8332 -j nixos-fw-accept" # bitcoin-rpc + "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 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" "nixos-fw -s 192.168.122.218 -p tcp --dport 445 -j nixos-fw-accept" "OUTPUT -t mangle -m cgroup --cgroup 11 -j MARK --set-mark 11" "POSTROUTING -t nat -m cgroup --cgroup 11 -o tun0 -j MASQUERADE" - ]; + ]); addRule = rule: "iptables -A ${rule}"; rmRule = rule: "iptables -D ${rule} || true"; diff --git a/nix-config/machines/quiver/default.nix b/nix-config/machines/quiver/default.nix @@ -11,7 +11,7 @@ extra: environment.systemPackages = with pkgs; [ acpi xorg.xbacklight sshuttle ]; - virtualisation.docker.enable = true; + virtualisation.docker.enable = false; virtualisation.virtualbox.host.enable = false; users.extraGroups.vboxusers.members = [ "jb55" ]; diff --git a/nix-config/nixpkgs/config.nix b/nix-config/nixpkgs/config.nix @@ -14,7 +14,7 @@ in { allowBroken = false; checkMeta = true; zathura.useMupdf = true; - + android_sdk.accept_license = true; packageOverrides = super: rec { qemu = super.qemu.override { @@ -54,14 +54,14 @@ in { # }; #}; - dunst = pkgs.lib.overrideDerivation super.dunst (attrs: { - src = pkgs.fetchFromGitHub { - owner = "jb55"; - repo = "dunst"; - rev = "138edff170e4e4a2bf6891bd634c4ec215d4b7ef"; - sha256 = "1pf3v4mrcd0cfhvm9fk9nwvgj5dy6qlbs0mhlcyx26cbqxd62brp"; - }; - }); + #dunst = pkgs.lib.overrideDerivation super.dunst (attrs: { + # src = pkgs.fetchFromGitHub { + # owner = "jb55"; + # repo = "dunst"; + # rev = "138edff170e4e4a2bf6891bd634c4ec215d4b7ef"; + # sha256 = "1pf3v4mrcd0cfhvm9fk9nwvgj5dy6qlbs0mhlcyx26cbqxd62brp"; + # }; + #}); #lastpass-cli = super.lastpass-cli.override { guiSupport = true; }; diff --git a/nix-config/services/default.nix b/nix-config/services/default.nix @@ -11,8 +11,8 @@ extra: #services.redis.enable = true; services.openssh.enable = true; - services.openssh.passwordAuthentication = false; - services.openssh.permitRootLogin = "no"; + services.openssh.settings.PasswordAuthentication = false; + services.openssh.settings.PermitRootLogin = "no"; services.atd.enable = true;