From 91b472a47ca54ddf85be29f66309f3031dd514a5 Mon Sep 17 00:00:00 2001 From: Peter Svensson Date: Tue, 7 Apr 2026 09:04:52 +0200 Subject: [PATCH] chore: update shell env and Brewfile Sync bash/fish PATH config, tweak bup.fish, update Brewfile and README. --- README.md | 13 ++------ dot_bashrc | 4 +++ dot_config/fish/config.fish | 6 ++++ dot_config/fish/functions/brew/bup.fish | 42 +++++++++++++++++-------- dot_local/share/Brewfile | 3 +- 5 files changed, 44 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index db353a7..1c3efa1 100644 --- a/README.md +++ b/README.md @@ -16,21 +16,14 @@ sudo softwareupdate --install-rosetta # chezmoi ```bash brew install chezmoi -brew install lastpass-cli -lpass login peter@sparetimecoders.com ``` ```bash chezmoi init --apply peter-svensson ``` -## Adding stuff to Lastpass +## Secrets Management (Proton Pass) -```bash -echo "$(cat ~/.gnupg/pubring.kbx | base64)" | lpass add --sync=now --non-interactive --notes "lambda/gnupg-pubring.kbx" -``` +Secrets are managed via Proton Pass using chezmoi's built-in `protonPass` and `protonPassJSON` template functions. -### SSH keys -```bash -printf "Private Key: %s\nPublic Key: %s" "$(cat ~/.ssh/id_rsa_plint_git)" "$(cat ~/.ssh/id_rsa_plint_git.pub)" | lpass add --sync=now --non-interactive --note-type=ssh-key "plint/git ssh key" -``` \ No newline at end of file +Ensure the Proton Pass CLI is installed and authenticated before running `chezmoi apply`. \ No newline at end of file diff --git a/dot_bashrc b/dot_bashrc index 6fd4446..fc104b0 100644 --- a/dot_bashrc +++ b/dot_bashrc @@ -31,3 +31,7 @@ fi if command -v direnv &> /dev/null; then eval "$(direnv hook bash)" fi + +if command -v wt >/dev/null 2>&1; then eval "$(command wt config shell init bash)"; fi + +. "$HOME/.local/share/../bin/env" diff --git a/dot_config/fish/config.fish b/dot_config/fish/config.fish index e673376..4bda846 100644 --- a/dot_config/fish/config.fish +++ b/dot_config/fish/config.fish @@ -1,5 +1,8 @@ # conf.d runs first! +# Force CLI tools to use English regardless of macOS language settings +set -gx LANGUAGE en_US.UTF-8 + # https://fishshell.com/docs/current/tutorial.html # https://github.com/jorgebucaran/fish-shell-cookbook # https://github.com/fish-shell/fish-shell/blob/master/share/config.fish @@ -63,3 +66,6 @@ end # This won't be added again if you remove it. source ~/.orbstack/shell/init2.fish 2>/dev/null || : +# Scaleway CLI autocomplete initialization. +eval (scw autocomplete script shell=fish) + diff --git a/dot_config/fish/functions/brew/bup.fish b/dot_config/fish/functions/brew/bup.fish index 01e84a6..26ef27f 100644 --- a/dot_config/fish/functions/brew/bup.fish +++ b/dot_config/fish/functions/brew/bup.fish @@ -6,8 +6,10 @@ function bup -d "Update homebrew, upgrade installed packages, and cleanup" if test $status -ne 0 if test (echo "$result" | grep -c 'uninstall') -gt 0 echo "Missing installed dependencies in Brewfile $file" - echo "Update before running again" - string join \n $result + echo "Update before running again, e.g.:" + echo " brew bundle cleanup --file $file --force" + string join \n $result \ + | string replace -a 'brew bundle cleanup --force' "brew bundle cleanup --file $file --force" return else echo "Errors in Brewfile $file?" @@ -17,8 +19,17 @@ function bup -d "Update homebrew, upgrade installed packages, and cleanup" end echo "Brewfile matches installation, updating packages" - brew update && brew upgrade && brew cleanup + brew update && brew upgrade; brew cleanup + + # Clean up stale caskroom directories left by failed upgrades (e.g. rename errors) set -l caskroom (brew --caskroom) + for stale_dir in (command ls -1 "$caskroom/" 2>/dev/null) + for suffix_dir in (command ls -1 "$caskroom/$stale_dir/" 2>/dev/null | string match '*.upgrading') + echo "Cleaning up stale upgrade directory: $stale_dir/$suffix_dir" + command rm -rf "$caskroom/$stale_dir/$suffix_dir" + end + end + for cask in (brew list --cask) brew info --cask $cask --json=v2 \ | jq -r '.casks[0] | [(.outdated | tostring), (.installed // "NONE"), .version] | @tsv' \ @@ -29,19 +40,21 @@ function bup -d "Update homebrew, upgrade installed packages, and cleanup" echo "Upgrading $cask from $installed to $current" set -l manual_installer (brew info --cask $cask --json=v2 \ | jq -r '.casks[0].artifacts[] | select(.installer) | .installer[] | select(.manual) | .manual // empty') - # Clean up old version directories that block upgrades - for old_ver in (command ls -1 "$caskroom/$cask/" 2>/dev/null) - if test "$old_ver" != "$current" - echo "Removing old caskroom version: $cask/$old_ver" - command rm -rf "$caskroom/$cask/$old_ver" - end - end if test -n "$manual_installer" + # Manual installers need reinstall + open the installer + for old_ver in (command ls -1 "$caskroom/$cask/" 2>/dev/null) + if test "$old_ver" != "$current" + command rm -rf "$caskroom/$cask/$old_ver" + end + end if brew reinstall --cask --force $cask set -l installer_path "$caskroom/$cask/$current/$manual_installer" if test -e "$installer_path" echo "Opening manual installer: $installer_path" - open "$installer_path" + if not open "$installer_path" + echo "Warning: 'open' failed for $installer_path" + echo "Run manually: open \"$installer_path\"" + end else echo "Warning: installer not found at $installer_path" echo "Check $caskroom/$cask/ manually" @@ -49,8 +62,11 @@ function bup -d "Update homebrew, upgrade installed packages, and cleanup" else echo "Warning: failed to reinstall $cask, skipping" end - else - brew upgrade --cask --greedy $cask; or echo "Warning: failed to upgrade $cask, skipping" + else if not brew upgrade --cask --greedy $cask + # Upgrade failed, likely stale caskroom dir -- clean up and force reinstall + echo "Retrying $cask: cleaning caskroom and reinstalling" + command rm -rf "$caskroom/$cask" + brew install --cask --force $cask; or echo "Warning: failed to reinstall $cask, skipping" end else echo "$cask:$current is latest version" diff --git a/dot_local/share/Brewfile b/dot_local/share/Brewfile index 216ef6d..8139a7d 100644 --- a/dot_local/share/Brewfile +++ b/dot_local/share/Brewfile @@ -69,7 +69,6 @@ brew "kubernetes-cli" brew "kops" brew "kube-ps1" brew "kustomize" -brew "lastpass-cli" brew "ldns" brew "libidn" brew "libpq" @@ -102,6 +101,7 @@ brew "python@3.11" brew "rbenv" brew "ripgrep" brew "rsync" +brew "scw" brew "ruby" brew "screen" brew "shfmt" @@ -166,6 +166,7 @@ go "tools/cmd/aws-iam-users" go "tools/cmd/aws-users" go "golang.org/x/tools/cmd/deadcode" go "github.com/gesquive/fast-cli" +go "github.com/richardartoul/gobuildcache" go "github.com/google/go-licenses" go "github.com/lietu/go-pre-commit" go "github.com/kevincobain2000/gobrew/cmd/gobrew"