-
Notifications
You must be signed in to change notification settings - Fork 1
/
install
executable file
·96 lines (78 loc) · 3.46 KB
/
install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
set -euo pipefail
DIR=$(cd "$(dirname "$0")"; pwd)
select profile in "home" "work"; do
case "$REPLY" in
1|2) break;;
*) continue;;
esac
done
if [ ! -f "${DIR}/etc/git/profile" ]; then
read -p "Set your git user.email: "
git config --file "${DIR}/etc/git/profile" user.email "${REPLY}"
fi
mkdir -p "${HOME}/.config"
mkdir -p "${HOME}/.local"
ln -sfh "${DIR}/bin" "${HOME}/.local/bin"
ln -sfh "${DIR}/etc/fish" "${HOME}/.config/fish"
ln -sfh "${DIR}/etc/gh" "${HOME}/.config/gh"
ln -sfh "${DIR}/etc/git" "${HOME}/.config/git"
ln -sfh "${DIR}/etc/mise" "${HOME}/.config/mise"
ln -sfh "${DIR}/etc/nvim" "${HOME}/.config/nvim"
ln -sfh "${DIR}/etc/zed" "${HOME}/.config/zed"
# I would like to just symlink all of etc into ~/.config, but some programs
# don't use their config directories in version-controllable ways. They should
# perhaps look to XDG_DATA_HOME instead!
#
# The offenders:
# - npm uses update-notifier, which uses configstore to track update checks.
# https://www.npmjs.com/package/update-notifier
# https://github.com/yeoman/update-notifier/blob/3046d0f61a57f8270291b6ab271f8a12df8421a6/update-notifier.js#L65-L70
# https://www.npmjs.com/package/configstore
# - op stores volatile state as well as a daemon socket.
#
# But if a new program starts writing into ~/.config, I want to see it here so
# I can consider adding it to version control, hence this `find` call.
#
find "${HOME}/.config" -type d -depth 1 \
-not -name configstore \
-not -name op \
-exec echo "$(tput setaf 3)Consider adding '{}' to version control.$(tput sgr0)" \;
which brew \
|| /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew update --verbose
brew bundle install --cleanup --verbose --file="${DIR}/opt/Brewfile.${profile}" --no-lock
brew cleanup --verbose
brew completions link
fish -c "mise use -g go@latest"
fish -c "mise use -g java@latest"
fish -c "mise use -g node@latest"
fish -c "mise use -g ruby@latest"
grep -q /opt/homebrew/bin/fish /etc/shells \
|| sudo bash -c 'echo /opt/homebrew/bin/fish >> /etc/shells'
# https://stackoverflow.com/a/41553295
dscl . -read ~ UserShell | grep -q /opt/homebrew/bin/fish \
|| chsh -s /opt/homebrew/bin/fish
fish -c "git submodule update --init --remote"
fish -c "make --directory ${DIR}/etc/nvim/pack/matthewtodd/start/telescope-fzf-native"
fish -c "nvim --headless -c 'helptags ALL' -c quit"
# https://macos-defaults.com
defaults write com.apple.AppleMultitouchTrackpad Clicking -bool true
defaults write com.apple.dock autohide -bool true
defaults write com.apple.dock show-recents -bool false
defaults write com.apple.dock static-only -bool true
defaults write com.apple.dock tilesize -int 56
defaults write com.apple.finder FXPreferredViewStyle -string clmv
killall Dock Finder
# https://github.com/Hammerspoon/hammerspoon/pull/582
defaults write org.hammerspoon.Hammerspoon MJConfigFile ${DIR}/etc/hammerspoon/init.lua
swiftc "${DIR}/src/dynamic_desktop.swift" -o "${DIR}/bin/dynamic_desktop"
swiftc "${DIR}/src/set_desktop_image.swift" -o "${DIR}/bin/set_desktop_image"
swiftc "${DIR}/src/terminal_profiles.swift" -o "${DIR}/bin/terminal_profiles"
"${DIR}/bin/dynamic_desktop" "${profile}" "${HOME}/Pictures/Solarized.heic"
# On macOS 14.0, this seems to always select the light (still) version, rather
# than automatically switching.
# "${DIR}/bin/set_desktop_image" "${HOME}/Pictures/Solarized.heic"
"${DIR}/bin/terminal_profiles"
# Why not? This could be fun.
open raycast://confetti