Merge branch 'master' into dependabot/pip/tests/black-24.3.0

This commit is contained in:
2024-06-27 11:23:09 +01:00
16 changed files with 316 additions and 9 deletions

View File

@@ -6,7 +6,7 @@ jobs:
name: Run test suite name: Run test suite
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4.1.1 - uses: actions/checkout@v4.1.6
# Run the tests # Run the tests
- name: 'Run tests' - name: 'Run tests'

View File

@@ -12,6 +12,14 @@ A local repository can be installed by running:
./script/install ./script/install
Once installed, updates can be applied by running:
dots
A specific script can be installed by running:
dots script1 script2 ...
### Automated setup ### Automated setup
This repository can be installed without a local copy This repository can be installed without a local copy

11
files/home/.aliases Normal file
View File

@@ -0,0 +1,11 @@
# dotfiles
alias dots=$DOTFILES/install
# jump around
alias j="z"
# zip
alias tarz="tar -czvf"
# unzip
alias tarx="tar -xzvf"
alias taru="tarx"

View File

@@ -85,6 +85,7 @@ if [ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]; then
. $HOME/.nix-profile/etc/profile.d/nix.sh . $HOME/.nix-profile/etc/profile.d/nix.sh
fi fi
# _ _ _ ____ # _ _ _ ____
# U /"\ u |"| ___ U /"\ u / __"| u # U /"\ u |"| ___ U /"\ u / __"| u
# \/ _ \/ U | | u |_"_| \/ _ \/ <\___ \/ # \/ _ \/ U | | u |_"_| \/ _ \/ <\___ \/
@@ -93,5 +94,7 @@ fi
# \\ >> // \\.-,_|___|_,-.\\ >> )( (__) # \\ >> // \\.-,_|___|_,-.\\ >> )( (__)
# (__) (__)(_")("_)\_)-' '-(_/(__) (__)(__) # (__) (__)(_")("_)\_)-' '-(_/(__) (__)(__)
# #
alias j="z"
alias fd=`command -v fdfind` if [ -f ~/.aliases ]; then
source ~/.aliases
fi

View File

@@ -8,10 +8,9 @@ source $HOME/.profile
export POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true export POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true
ZSH_THEME="powerlevel10k/powerlevel10k" ZSH_THEME="powerlevel10k/powerlevel10k"
export DISABLE_AUTO_UPDATE="true"
export ZSH="$HOME/.oh-my-zsh" export ZSH="$HOME/.oh-my-zsh"
zstyle ':omz:update' frequency 13
# https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins # https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins
plugins=( plugins=(
aliases aliases

View File

@@ -5,8 +5,8 @@ set -eo pipefail
# Script to run all install scripts contained in install.d # Script to run all install scripts contained in install.d
# #
printf "\n\t <<< dots installer >>>\n" printf "\n\t <<< dots >>>\n"
printf "\t========================\n\n\n" printf "\t==============\n\n\n"
# Prevent running as root # Prevent running as root
if [[ $EUID -eq 0 && -z "$SKIP_SUDO_CHECK" ]]; then if [[ $EUID -eq 0 && -z "$SKIP_SUDO_CHECK" ]]; then
@@ -49,12 +49,28 @@ if [[ ! -f "$log_target" ]]; then
fi fi
log_abs_target=$(readlink -f "$log_target") log_abs_target=$(readlink -f "$log_target")
# Set up targets
targets=($@)
# Run install scripts # Run install scripts
install() { run() {
echo "Running \"$(basename "$0")\" at \"$(date)\"" echo "Running \"$(basename "$0")\" at \"$(date)\""
echo "Running as \"$(whoami)\" on \"$(hostname)\"" echo "Running as \"$(whoami)\" on \"$(hostname)\""
if [[ -n "$targets" ]]; then
echo "Running ${#targets[@]} install target(s): ${targets[@]}"
else
echo "Running all install targets"
fi
for script in $install_dir/*.sh; do for script in $install_dir/*.sh; do
if [[ -n "$targets" ]]; then
script_name=$(basename $script .sh)
script_name=${script_name#*-}
if [[ ! " ${targets[*]} " =~ " $script_name " ]]; then
continue
fi
fi
script_name=$(basename $script) script_name=$(basename $script)
printf "\n\n<<< $script_name:\n" printf "\n\n<<< $script_name:\n"
source $script source $script
@@ -63,7 +79,7 @@ install() {
done done
} }
echo "install: Logging to \"$log_abs_target\"" echo "install: Logging to \"$log_abs_target\""
install 2>&1 | tee "$log_abs_target" run 2>&1 | tee "$log_abs_target"
# Clean up # Clean up
unset uuid dir install_dir log_dir log_abs_target log_target unset uuid dir install_dir log_dir log_abs_target log_target

View File

@@ -5,6 +5,11 @@
# Print SSH key. # Print SSH key.
# #
# skip if CODESPACES is set
if [ -n "$CODESPACES" ]; then
export SKIP_SSH_CONFIG=1
fi
# skip if SKIP_SSH_CONFIG is set # skip if SKIP_SSH_CONFIG is set
if [ -z "$SKIP_SSH_CONFIG" ]; then if [ -z "$SKIP_SSH_CONFIG" ]; then
ssh_method="ed25519" ssh_method="ed25519"

View File

@@ -8,8 +8,11 @@
if [[ "$OSTYPE" == "darwin"* ]]; then if [[ "$OSTYPE" == "darwin"* ]]; then
export NONINTERACTIVE=1 export NONINTERACTIVE=1
if ! command -v brew &> /dev/null; then if ! command -v brew &> /dev/null; then
echo "Installing Homebrew..."
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
eval "$(/opt/homebrew/bin/brew shellenv)" eval "$(/opt/homebrew/bin/brew shellenv)"
else
echo "Homebrew is already installed."
fi fi
brew update brew update

View File

@@ -17,3 +17,5 @@ if ! command -v gh &>/dev/null; then
brew install gh brew install gh
fi fi
fi fi
gh --version

View File

@@ -0,0 +1,17 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# Install Azure CLI.
#
if ! command -v az &>/dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
# https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install azure-cli
fi
fi
az --version

View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# (macOS only) Install MeetingBar.
#
if [[ "$OSTYPE" == "darwin"* ]]; then
if ! brew list --cask meetingbar &> /dev/null; then
brew install --cask meetingbar
else
echo "MeetingBar is already installed."
fi
fi

View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# (macOS only) Install BetterDisplay.
#
if [[ "$OSTYPE" == "darwin"* ]]; then
if ! brew list --cask betterdisplay &> /dev/null; then
brew install --cask betterdisplay
else
echo "BetterDisplay is already installed."
fi
fi

View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# (macOS only) Install dockutil.
#
if [[ "$OSTYPE" == "darwin"* ]]; then
if ! brew list dockutil &> /dev/null; then
brew install dockutil
else
echo "dockutil is already installed."
fi
fi

View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# Install cmatrix.
#
if ! command -v "cmatrix" &>/dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo apt-get install -qq cmatrix &>/dev/null
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install cmatrix
fi
fi

View File

@@ -0,0 +1,187 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# (macOS only) Configure defaults
#
if [[ "$OSTYPE" == "darwin"* ]]; then
# Keyboard
# --------
# off -- Keyboard: Capitalize words automatically
defaults write -globalDomain NSAutomaticCapitalizationEnabled -bool false
# off -- Keyboard: Add period with double-space
defaults write -globalDomain NSAutomaticPeriodSubstitutionEnabled -bool false
# off -- Keyboard: Quote substitution
defaults write -globalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
# off -- Keyboard: Dash substitution
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
# off -- Keyboard: Auto-correct
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
defaults write NSGlobalDomain WebAutomaticSpellingCorrectionEnabled -bool false
# Appearance
# ----------
# Multicolour -- Appearance
defaults write -globalDomain AppleAquaColorVariant -int 0
# on -- Appearance: Dark mode
defaults write -globalDomain AppleInterfaceStyle -string "Dark"
# #2CB494 -- Highlight color
defaults write -globalDomain AppleHighlightColor -string "0.172549 0.705882 0.580392"
killall SystemUIServer 2>/dev/null || true
# Control Center
# --------------
# off -- Control Center: Show Bluetooth icon in menu bar
defaults write \
~/Library/Preferences/ByHost/com.apple.controlcenter.plist \
Bluetooth \
-int 24
# off -- Control Center: Show Wi-Fi icon in menu bar
defaults write \
~/Library/Preferences/ByHost/com.apple.controlcenter.plist \
WiFi \
-int 24
# off -- Control Center: Show Now Playing icon in menu bar
defaults write \
~/Library/Preferences/ByHost/com.apple.controlcenter.plist \
NowPlaying \
-int 24
# off -- Control Center: Show Battery icon in menu bar
defaults write \
~/Library/Preferences/ByHost/com.apple.controlcenter.plist \
Battery \
-int 24
killall ControlCenter 2>/dev/null || true
# Finder
# ------
# on -- Finder: Add quit option
defaults write com.apple.finder QuitMenuItem -bool true
# on -- Finder: Show hidden files
defaults write com.apple.finder AppleShowAllFiles -bool true
# on -- Finder: Show all filename extensions
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# off -- Finder: Show warning before changing an extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# on -- Finder: Show path bar
defaults write com.apple.finder ShowPathbar -bool true
# on -- Finder: Show status bar
defaults write com.apple.finder ShowStatusBar -bool true
# on -- Finder: Keep folders on top
defaults write com.apple.finder _FXSortFoldersFirst -bool true
# off -- Finder: Use macOS Crash Reporter
defaults write com.apple.CrashReporter DialogType -string "none"
# off -- Finder: Enable dashboard widgets
defaults write com.apple.dashboard mcx-disabled -bool true
# on -- Finder: Show hard drives on desktop
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true
# on -- Finder: Show external hard drives on desktop
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
# on -- Finder: Show removable media on desktop
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true
# on -- Finder: Show mounted servers on desktop
defaults write com.apple.finder ShowMountedServersOnDesktop -bool true
# off -- Finder: Show recent tags
defaults write com.apple.finder ShowRecentTags -bool false
# off -- Finder: Create .DS_Store files
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
# home -- Finder: New Finder windows show
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/"
# list -- Finder: Preferred view style
defaults write com.apple.finder FXPreferredViewStyle -string "nlsv"
killall Finder 2>/dev/null || true
# Spotlight
# ---------
# on -- Spotlight: Hide menu bar icon
defaults write com.apple.Spotlight MenuItemHidden -int 1
killall Spotlight 2>/dev/null || true
# Dock
# ----
# off -- Dock: Show recent applications
defaults write com.apple.dock show-recents -bool false
# on -- Dock: Use scroll gestures
defaults write com.apple.dock scroll-to-open -bool true
# Remove default apps from the dock
default_apps=(
"Messages"
"Mail"
"Maps"
"Photos"
"FaceTime"
"Calendar"
"Contacts"
"Reminders"
"Freeform"
"TV"
"Music"
"News"
"Keynote"
"Numbers"
"Pages"
)
for default_app in default_apps; do
dockutil --remove "$default_app" --no-restart 1>/dev/null 2>&1 || true
done
# Set up apps in the dock
dock_order=(
"/System/Library/CoreServices/Finder.app" # Cannot be moved
"/System/Applications/App Store.app"
"/System/Applications/Launchpad.app"
"/System/Applications/System Settings.app"
"/System/Applications/Utilities/Activity Monitor.app"
"/Applications/iTerm.app"
)
dock_state=$(defaults read com.apple.dock persistent-apps)
for i in "${!dock_order[@]}"; do
if [[ $i -ne 0 ]]; then
path="${dock_order[$i]}"
name=$(basename "$path" | sed 's/\.app$//')
if [[ $dock_state == *"$name"* ]]; then
dockutil --move "${path}" --position $i --no-restart
else
dockutil --add "${path}" --position $i --no-restart
fi
fi
done
if [[ ! $dock_state == *"spacer"* ]]; then
dockutil --add '' --type spacer --section apps --position "${#dock_order[@]}" --no-restart
fi
killall Dock 2>/dev/null || true
fi