Setup Checklist

  1. Arch Install
[Reference](./arch.md)

Setup private pacman repo

Setup dev machine for publishing packages

Create Key

set -euo pipefail
umask 077

# Create gpg key password
ITEM_ID="$(op item create --category Password --vault Private --title "pacman gpg key" --generate-password='letters,digits,64' --format json | jq -r .id)"

# Display password so you can enter it when prompted
op item get "${ITEM_ID}" --reveal --fields "password" --format json | jq -r .value 

gpg --full-generate-key
# Choose ECC sign only because we only need to sign for publishing packages use-case, no encryption needed.
# (10) ECC (sign only)
# Choose Curve 25519 option because it is widely supported
# (1) Curve 25519 *default*
# Select 2 years for expiration so if you lose the key it will automatically expire, it is fine to extend expiration
# Real name: frii.day Pacman Repository
# Email address: pacman@frii.day
# Comment: Package Signing

GPG_FINGERPRINT="$(gpg --with-colons --fingerprint --list-secret-keys "pacman@frii.day" | awk -F: '$1 == "fpr" { print $10; exit }')"

PRIVATE_KEY_NAME="pacman-signing-private.asc"
PUBLIC_KEY_NAME="pacman-signing-public.asc"

TMP_DIR="$(mktemp -d)"
trap 'rm -rf "$TMP_DIR"' EXIT

gpg --armor --export-secret-keys "${GPG_FINGERPRINT}"  > "${TMP_DIR}/${PRIVATE_KEY_NAME}"
gpg --armor --export "${GPG_FINGERPRINT}" > "${TMP_DIR}/${PUBLIC_KEY_NAME}"

op item edit "${ITEM_ID}" "private_key[file]=${TMP_DIR}/${PRIVATE_KEY_NAME}"
op item edit "${ITEM_ID}" "public_key[file]=${TMP_DIR}/${PUBLIC_KEY_NAME}"
op item edit "${ITEM_ID}" "rev_cert[file]=${HOME}/.gnupg/openpgp-revocs.d/${GPG_FINGERPRINT}.rev"


# todo generating the key locally is fine but put in on pi since doing the signing locally is awkward
# op read 'op://Private/pacman-gpg-key/password' |
#   ssh alarm 'gpg --batch --pinentry-mode loopback --passphrase-fd 0 ...'

Upload Private Key To pacman server

set -euo pipefail

GPG_FINGERPRINT="$(gpg --with-colons --fingerprint --list-secret-keys "pacman@frii.day" | awk -F: '$1 == "fpr" { print $10; exit }')"
ssh alarm "echo \"GPGKEY=${GPG_FINGERPRINT}\" > ~/.makepkg.conf"
TEMP_KEY="/tmp/key.gpg"
op read "op://Private/pacman gpg key/private_key" | ssh alarm "cat > ${TEMP_KEY}"
op item get --reveal "pacman gpg key" --fields "password" |
    ssh alarm "gpg --batch --pinentry-mode loopback --passphrase-fd 0 --import ${TEMP_KEY}"
  1. ./fossil_install.md

  2. Install treesitter parsers for neovim

nvim
:TSInstall go rust javascript css html sql markdown lua bash toml json regex
  1. Nats CLI
go install github.com/nats-io/natscli/nats@latest
  1. Basic Node setup (needed on all nodes dev, server, etc) Background services running as non root
mkdir -p ~/deploy
mkdir -p /home/piegarden/.local/share/systemd/user
# needed otherwise services will only work when the user is logged in
sudo loginctl enable-linger $USER
# verify
loginctl show-user $USER -p Linger
  1. Remove Windows Junk Use custom removal option, because you really want to get rid of the game bar stuff. It is very annoying https://github.com/Raphire/Win11Debloat

  2. Install Webi CLI (not on arch though, pacman/yay good good)

  3. Install GitHub CLI (not on arch).

    webi gh
    
  4. Install monitor manager (really good for getting a new monitor configured correctly) Option 1. (prefered) Reference

    yay -S hyprmon-bin
    # run hyprmon and set positioning and scaling
    hyprmon
    

    Option 2. Alternatively you can edit the monitors.conf file, but I found the TUI to be a far better experience Scalling to monitor size, you can also just use the TUI and uninstall it after Uncomment the correct lines in:

    ~/.config/hypr/monitors.conf
    
  5. Install Neovim Helpers.

    cd ~/Downloads
    
    git clone https://codeberg.org/jeremiahvaughan/base64-toggle.git
    cargo install --path ./base64-toggle
    
    git clone https://codeberg.org/jeremiahvaughan/random-string.git
    cargo install --path ./random-string
    
    cd -
    
  6. Verify Neovim health.

    • Reference

    • Open Neovim.

    • If you see an install error, it just means something needs to be installed; handle the dependency and restart Neovim.

    • After restarting, run:

      :checkhealth
      
    • If Neovim misbehaves, view logs with:

      :messages
      

      For tree-sitter issues you may want to clear the cache: nvim troubleshooting

  7. Install the nvim-helper CLI used by <leader>b and the random log helpers.

    cd ~/.config/nvim/tools/nvim-helper
    go install
    
    • Ensure the resulting binary directory (usually $GOBIN or $GOPATH/bin) is on your PATH.
    • Run make nvim-helper-test (from the repo root) to execute the helper's unit tests; the command automatically isolates Go's build cache in /tmp/nvim-gocache.
    • Run make base64-test to execute the Neovim end-to-end check that exercises the mapping against a scratch buffer.
    • Use :GoUpdate inside Neovim to run the helper's Go module updater; set vim.g.go_update_target_version (defaults to 1.24.7) to control the enforced go directive and populate the quickfix list with updated go.mod files.
  8. Install staticcheck for additional Go analysis.

  9. Install htop for resource monitoring.

    • Unix

      brew install htop
      
    • Windows

      choco install ntop.portable
      
    • Deb

      sudo apt install htop
      
  10. Install shellcheck for shell script linting.

  11. Configure production & staging in .ssh/config

    • Optional: sftp another computer and copy that .ssh/config
  12. Install raspberry pi imager

    sudo pacman -S rpi-imager
    sudo -E rpi-imager
    
  13. Syncthing / Wiki

  14. Install Fossil

  15. Secrets Management

  16. Cron Jobs

  17. For windows install

    choco install windirstat
    

    Revo Uninstaller

  18. mkcert

    sudo pacman -S mkcert
    
  19. Inkscape

    sudo pacman -Syu inkscape
    
  20. Net Tools (nslookup)

    sudo pacman -S bind
    

References

Using vim-dadbod

Command to open vim-dadbod

:DBUI 

Connection string format for sqlite

sqlite://<file-system-path>

Example:

sqlite:///data/data.db
  1. Sqlite

    #deb
    sudo apt update
    sudo apt install sqlite3
    #arch
    sudo pacman -S sqlite
    
  2. Markdown Linter

    cargo install rumdl
    
  3. Paper Scanner

Plugin the scanner via usb

Driver Scan Button Helper

sudo apt update
sudo apt install sane-utils libsane1

cat << EOF > scan.service
[Unit]
Description=Scanner Service that allows button on scanner to work
After=network-online.target

[Service]
WorkingDirectory=/home/piegarden/Downloads
ExecStart=/usr/bin/brscan-skey -f
Restart=always
RestartSec=45

[Install]
WantedBy=default.target
EOF
# Check connected scanners
scanimage -L

Golang Profiler

Setup

sudo apt-get install graphviz -y

Generate profile and view

make p
go tool pprof http://localhost:8081/debug/pprof/profile?seconds=30
go tool pprof -http=:8082 http://localhost:8081/debug/pprof/profile?seconds=1

Install Maybe

  1. Install bat (used by the snippets generator).

  2. Configure copy/paste for remote SSH sessions.

    • macOS via iTerm2 (recommended).

    • macOS alternative:

      cp ./alacritty.toml "$HOME/.alacritty.toml"
      

      or

      cp ./.wezterm.lua "$HOME/.wezterm.lua"
      
    • Windows:

      Copy-Item .\alacritty.toml $env:APPDATA\alacritty\alacritty.toml
      

      or

      Copy-Item .\.wezterm.lua $env:USERPROFILE\.wezterm.lua
      
  3. Install Starship.

    • Reference: https://starship.rs

    • Place configs:

      ln -s "$HOME/.config/nvim/starship/starship.toml" ~/.config/starship.toml
      
    • Windows PowerShell profile:

      Copy-Item .\starship\Microsoft.PowerShell_profile.ps1 $profile
      
  4. Ensure the Chrome Tab Limit extension is installed and set to 4 tabs.

  5. Ubuntu accessibility adjustments:

    • Disable slow animations.
    • Enable large text.
    • Enable Night Light via Settings → Displays.
    • Configure fingerprint reader.
  6. Install 1Password TUI.

    go install github.com/JeremiahVaughan/one-password-tui@latest
    
  7. Install i3.

    sudo apt install i3 -y
    mkdir -p ~/.config/i3
    cp ./i3/config ~/.config/i3/config
    
  8. Install zsh (optional; bash is fine).

    sudo apt install zsh -y
    chsh -s /bin/zsh
    
  9. fzf

    webi fzf
    
  10. AP mode in case you don't have a wireless AP handy: ref: https://wiki.archlinux.org/title/Software_access_point

    sudo pacman -S hostapd
    sudo pacman -S dnsmasq
    in /etc/hostapd/hostapd.conf
        set ssid, wpa_passphrase, 
    

    enable ieee80211n, ieee80211d, ieee80211ac, ieee80211ax, disable require_ht (windows wants this) set: wpa=2, wpa_key_mgmt=WPA-PSK, rsn_pairwise=CCMP, country_code=US

     sudo systemctl enable hostapd
     sudo systemctl start hostapd
     sudo systemctl enable dnsmasq
     sudo systemctl start dnsmasq
     sudo mkdir /etc/systemd/system/hostapd.service.d
     sudo nvim /etc/systemd/system/hostapd.service.d/override.conf
    
    
     [Unit]
     BindsTo=sys-subsystem-net-devices-wlan0.device
     After=sys-subsystem-net-devices-wlan0.device
    
     check active dns leases
     ```bash
     cat /var/lib/misc/dnsmasq.leases
    
    
  11. Firefox as alternate popular browser for testing

    yay -S firefox
    # or
    sudo pacman -S firefox
    
  12. Rust TUI email client

    cargo install himalaya --locked --features "oauth2 keyring"
    

    Install one password cli to manage the email secrets OnePassword

  13. Crush (opencode) Reference

    go install github.com/charmbracelet/crush@latest
    # give crush the golang lsp
    webi go-essentials
    # give crush the rust lsp
    rustup component add rust-analyzer
    # place your api key:
    # 1 (neovide). ~/.config/uwsm/env
    # 2 (shell). ~/.bashr
    

    Local model install Ollama On Windows make sure Ollama is exposed

  14. In settings, open it up to local network

  15. Set env var

    OLLAMA_HOST=0.0.0.0
    
  16. anki flash cards Install

export VERSION="26.08"
tar xaf "Downloads/anki-${VERSION}-linux-x86_64.tar.zst"
cd anki-linux
mkdir -p ~/Applications
mv anki.png "${HOME}/Applications/anki.png"
sudo ./install.sh

export ANKI=$(which anki)
cat <<-EOF > "${HOME}/.local/share/applications/anki.desktop"
[Desktop Entry]
Name=Anki
Exec=${ANKI}
Icon=${HOME}/Applications/anki.png
Type=Application
Categories=Utility;
Terminal=false
EOF

Troubleshooting

Recovery

Run recover:

./recovery.sh

Mass Deploy

./mass-deploy.sh

Nvim

  1. Wipe out NVIM cache:

    rm -rf ~/.cache/nvim ~/.local/state/nvim ~/.local/share/nvim
    
    Remove-Item -Recurse -Force "$env:LOCALAPPDATA\nvim-data"
    
  2. Start neovim with no configs

    nvim -u NONE
    

Kill a service that refuses to die

systemctl --user kill -s SIGKILL <service_name>

Maintenance

Database maintenance

If you need to delete a bunch of data from the DB:

# Turn off database backups
systemctl --user stop jobby

# Turn off the service
systemctl --user stop shepherd

# Run the query
sqlite3 ~/deploy/shepherd-data/data 'DELETE FROM service_log;'

# Vacuum the database
sqlite3 ~/deploy/shepherd-data/data 'VACUUM;'

# Checkpoint the WAL file
sqlite3 ~/deploy/shepherd-data/data 'PRAGMA wal_checkpoint(TRUNCATE);'

# Verify sizes are what you expect
ls -hal ~/deploy/shepherd-data

# Turn on the database backups
systemctl --user start jobby

# Turn on the service
systemctl --user start shepherd

Home Router

Direct ports for UDP for current node

cd ~/deploy
fd -t f -g 'port.txt' -x sh -c 'head -n1 "$1"' sh {} | paste -sd, -