···1515# ==============================================================================
16161717# It would be nicer to use __dir__ here, but seems that this file is sometimes
1818-# `evalged which leaves __dir__ as an empty string. So we just hardcode the path.
1818+# `eval`ed which leaves __dir__ as an empty string. So we just hardcode the path.
1919Dir.glob(File.join(Dir.home, ".config", "brew", "*.Brewfile")) do |brewfile|
2020 STDERR.puts "Loading #{brewfile}..."
2121 instance_eval File.read(brewfile)
···7474brew "colima"
7575# Git extension for versioning large files
7676brew "git-lfs"
7777+# Pack, ship and run any application as a lightweight container
7878+brew "docker"
7979+# Platform keystore credential helper for Docker
8080+brew "docker-credential-helper"
8181+# Framework for managing multi-language pre-commit hooks
8282+brew "pre-commit"
8383+# Search tool like grep and The Silver Searcher
8484+brew "ripgrep"
···11-# Install in home dir instead of /Applications
22-cask_args appdir: "~/Applications"
33-41# Fast static site generator in a single binary with everything built-in
52brew "zola"
63# Rust toolchain installer
74brew "rustup-init"
88-99-# 3D creation suite
1010-cask "blender"
1111-# Nintendo 3DS emulator
1212-cask "citra"
1313-# Voice and text chat software
1414-cask "discord"
1515-# VPN client for secure internet access and private browsing
1616-cask "nordvpn"
1717-# Instant messaging application focusing on security
1818-cask "signal"
1919-# Video game digital distribution service
2020-cask "steam"
2121-# Main codebase
2222-cask "texworks"
2323-# Add indentation to LaTeX files
2424-brew "latexindent"
2525-# Compact TeX distribution as alternative to the full TeX Live / MacTeX
2626-cask "basictex"
···55tap "d12frosted/emacs-plus"
6677# ==============================================================================
88+# Device-specific brewfiles
99+# ==============================================================================
1010+1111+# It would be nicer to use __dir__ here, but seems that this file is sometimes
1212+# `eval`ed which leaves __dir__ as an empty string. So we just hardcode the path.
1313+Dir.glob(File.join(Dir.home, ".config", "brew", "casks", "*.Brewfile")) do |brewfile|
1414+ STDERR.puts "Loading #{brewfile}..."
1515+ instance_eval File.read(brewfile)
1616+end
1717+1818+# ==============================================================================
819# Formulae
920# ==============================================================================
1021···6374cask "visual-studio-code"
6475# Multimedia player
6576cask "vlc"
7777+# Utility to create and modify archives
7878+cask "betterzip"
7979+tap "homebrew/cask-fonts"
8080+# QuickLook generator for Markdown files
8181+cask "qlmarkdown"
8282+# Thumbnails, static previews, cover art and metadata for video files
8383+cask "qlvideo"
8484+# Quicklook extension for source files
8585+cask "syntax-highlight"
8686+# Video communication and virtual meeting platform
8787+cask "zoom"
···11+# Install in home dir instead of /Applications
22+cask_args appdir: "~/Applications"
33+44+# 3D creation suite
55+cask "blender"
66+# Nintendo 3DS emulator
77+cask "citra"
88+# Voice and text chat software
99+cask "discord"
1010+# VPN client for secure internet access and private browsing
1111+cask "nordvpn"
1212+# Instant messaging application focusing on security
1313+cask "signal"
1414+# Video game digital distribution service
1515+cask "steam"
1616+# Main codebase
1717+cask "texworks"
1818+# Add indentation to LaTeX files
1919+brew "latexindent"
2020+# Compact TeX distribution as alternative to the full TeX Live / MacTeX
2121+cask "basictex"
+39-5
.config/yadm/hooks/pre_commit
···2233set -o nounset
4455+tmpdir=$(mktemp -d)
66+# trap 'rm -rf $tmpdir' EXIT
57trap 'echo ; exit -2' INT
88+echo "$tmpdir"
69710# Start from the base yadm directory
811cd "$(dirname "${BASH_SOURCE[0]}")" || exit_with_error "Failed to find yadm directory!"
···4245 fi
4346fi
44474545-# TODO: maybe do a brew bundle dump and check against that somehow... particularly
4646-# for vscode extensions it would be nice to automatically update the list.
4747-if grep --quiet Brewfile <(echo "$CHANGED_FILES"); then
4848- echo "Checking that all packages in Brewfile are installed..."
4848+if grep --quiet Brewfile <(echo "$CHANGED_FILES") && command -v brew >/dev/null; then
4949 # A little faster if we don't have to wait for auto-update
5050 export HOMEBREW_NO_AUTO_UPDATE=1
5151- if ! brew bundle check --global --no-upgrade --verbose ; then
5151+ set -o pipefail
5252+5353+ # TODO: maybe check this all the time instead of just when brewfile changes
5454+ if command -v jq >/dev/null; then
5555+ echo "Checking that all installed packages are in Brewfile..."
5656+ if ! {
5757+ brew bundle dump --quiet --file "$tmpdir/Brewfile" &&
5858+ brew bundle install --quiet --no-upgrade --file "$tmpdir/Brewfile"
5959+ } >/dev/null; then
6060+ warn "Failed to dump current brew packages"
6161+ WARNINGS=$((WARNINGS + 1))
6262+ fi
6363+6464+ # TODO: only add `brew leaves` packages, not all lockfile packages
6565+6666+ jq '.entries | .brew | to_entries | .[].key' -r "$tmpdir/Brewfile.lock.json" |
6767+ xargs brew add --global --formula 2>/dev/null
6868+ WARNINGS=$((WARNINGS + $?))
6969+ jq '.entries | .cask | to_entries | .[].key' -r "$tmpdir/Brewfile.lock.json" |
7070+ xargs brew add --cask --file ~/.config/brew/20-os.Brewfile 2>/dev/null
7171+ WARNINGS=$((WARNINGS + $?))
7272+7373+ # TODO: add warning if entries added, pre-commit would make this easier
7474+7575+ # TODO: vscode not supported yet
7676+ # jq '.entries | .vscode | to_entries | .[].key' -r "$tmpdir/Brewfile.lock.json" |
7777+ # xargs brew add --file ~/.config/brew/30-vscode.Brewfile
7878+ fi
7979+8080+ echo "Checking that all packages in Brewfile are installed..."
8181+ if ! brew bundle check --global --no-upgrade --verbose | grep -E 'needs|satisfied'; then
5282 warn "Brewfile(s) is out of date or incorrect"
5383 WARNINGS=$((WARNINGS + 1))
5484 fi
8585+8686+ set +o pipefail
5587fi
56885789# Check for unstaged changes (typically new functions/completions or config files)
···83115fi
8411685117# TODO: convert other scripts to fish instead of bash (except bootstrap)
118118+# or actually, just user pre-commit instead of this mess. Maybe bootstrap could
119119+# also be converted to something less complicated