install.fairie/dotfiles/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_before_10_install-darwin-dependencies.tmpl

28 lines
913 B
Bash

#!/usr/bin/env bash
# Required for styled logging
{{- includeTemplate "universal/logg" }}
logg 'Ensuring `xcode-select` is installed'
xcode-select -p >/dev/null 2>&1 || xcode-select --install
if ! command -v brew >/dev/null 2>&1; then
logg 'Installing Homebrew'
/bin/sh -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
else
logg 'Homebrew is already installed'
fi
{{ if eq .host.arch "arm64" -}}
eval $(/opt/homebrew/bin/brew shellenv)
{{- else }}
eval $(/usr/local/bin/brew shellenv)
{{- end }}
logg 'Installing base dependencies for macOS using `brew bundle`'
logg info 'Dependencies: age asdf jq node go-task/tap/go-task volta yq m-cli zx'
logg info 'GNU compatibility dependencies: coreutils findutils gawk gnu-getopt gnu-indent gnu-tar gnu-sed gnutls grep'
brew bundle --verbose --no-lock --file=/dev/stdin <<EOF
{{ includeTemplate "darwin/Brewfile" . }}
EOF