-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
119 lines (100 loc) · 5.23 KB
/
Copy pathinstall.sh
File metadata and controls
119 lines (100 loc) · 5.23 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/usr/bin/env bash
set -euo pipefail
# -------------------------------------------------------------------------------------------------------------
# 🚀 macOS Bootstrap Script
# -------------------------------------------------------------------------------------------------------------
# User configuration
USER_NAME="John Carey"
USER_EMAIL="certifiedcloudarchitect@gmail.com"
HOSTNAME="noctua"
DOTFILES_DIR="$HOME/dotfiles"
echo "🚀 Starting macOS environment setup..."
# -------------------------------------------------------------------------------------------------------------
# 🛠️ Xcode Command Line Tools
# -------------------------------------------------------------------------------------------------------------
if ! xcode-select -p &>/dev/null; then
echo "🛠️ Installing Xcode Command Line Tools..."
xcode-select --install
until xcode-select -p &>/dev/null; do sleep 5; done
fi
# -------------------------------------------------------------------------------------------------------------
# 🍺 Homebrew
# -------------------------------------------------------------------------------------------------------------
if ! command -v brew &>/dev/null; then
echo "🍺 Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> "$HOME/.zprofile"
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
echo "📦 Installing Homebrew packages..."
brew bundle --file="$DOTFILES_DIR/Brewfile"
brew cleanup
# -------------------------------------------------------------------------------------------------------------
# ⚙️ macOS System Configuration
# -------------------------------------------------------------------------------------------------------------
echo "⚙️ Applying macOS system configurations..."
bash "$DOTFILES_DIR/macos/defaults.sh" true
bash "$DOTFILES_DIR/macos/hostname.sh" "$HOSTNAME"
# -------------------------------------------------------------------------------------------------------------
# 🔐 User Configurations (SSH, GPG, Git)
# -------------------------------------------------------------------------------------------------------------
echo "🔑 Configuring SSH..."
bash "$DOTFILES_DIR/setup-scripts/configure-ssh.sh" "$USER_EMAIL" true
echo "🔐 Configuring GPG..."
bash "$DOTFILES_DIR/setup-scripts/configure-gpg.sh" "$USER_NAME" "$USER_EMAIL" true
echo "📝 Configuring Git..."
bash "$DOTFILES_DIR/setup-scripts/configure-git.sh" "$USER_NAME" "$USER_EMAIL" true
# -------------------------------------------------------------------------------------------------------------
# 🖥️ Shell and Development Tools
# -------------------------------------------------------------------------------------------------------------
# Zinit installation (shell plugin manager)
if [ ! -d "$HOME/.zinit/bin" ]; then
echo "🔌 Installing Zinit..."
bash -c "$(curl -fsSL https://git.io/zinit-install)"
fi
# Nix package manager installation
# https://determinate.systems/posts/determinate-nix-installer/
if ! command -v nix &>/dev/null; then
echo "📦 Installing Nix package manager..."
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
# uninstall
# /nix/nix-installer uninstall
fi
# Devbox installation
# https://www.jetify.com/docs/devbox/installing_devbox/?install-method=macos
if ! command -v devbox &>/dev/null; then
echo "📦 Installing Devbox..."
curl -fsSL https://get.jetpack.io/devbox | bash
fi
echo "📦 Activating Devbox environment..."
devbox install
devbox shell
echo "🎉 macOS bootstrap complete! Please restart your terminal."
#-------------------------------------------------------------------------------------------------------------
# 🔑 Print SSH Public Key Output for GitHub
# https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account
#-------------------------------------------------------------------------------------------------------------
if [ -d "$HOME/.ssh" ]; then
echo " ____ ____ _ _ _ "
echo " / ___/ ___|| | | | | | _____ _ _ "
echo " \___ \___ \| |_| | | |/ / _ \ | | |"
echo " ___) |__) | _ | | < __/ |_| |"
echo " |____/____/|_| |_| |_|\_\___|\__, |"
echo " |___/ "
cat "$HOME"/.ssh/id_ed25519.pub
echo "🔑 Print SSH key..Done!"
fi
#-------------------------------------------------------------------------------------------------------------
# 🔐 Print GPG Public Key Output for GitHub
# https://docs.github.com/en/authentication/managing-commit-signature-verification/adding-a-new-gpg-key-to-your-github-account
#-------------------------------------------------------------------------------------------------------------
if [ -d "$HOME/.gnupg" ]; then
echo " ____ ____ ____ _ "
echo " / ___| _ \ / ___| | | _____ _ _ "
echo " | | _| |_) | | _ | |/ / _ \ | | |"
echo " | |_| | __/| |_| | | < __/ |_| |"
echo " \____|_| \____| |_|\_\___|\__, |"
echo " |___/ "
gpg --armor --export "$(gpg --list-secret-keys --with-colons | awk -F: '$1 == "sec" {print $5}')"
echo "🔐 Print GPG key...Done!"
fi