Repository navigation
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·56 lines (47 loc) · 1.78 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·56 lines (47 loc) · 1.78 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
#!/bin/bash
# Bootstrap script for paveg/dots
# Usage: curl -fsSL https://raw.githubusercontent.com/paveg/dots/main/install.sh | bash
# With work environment: curl -fsSL ... | BUSINESS_USE=1 bash
set -e
echo "==> Installing dotfiles..."
# Install Nix if not present (required by devbox)
if ! command -v nix &>/dev/null; then
echo "==> Installing Nix..."
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --no-confirm
# Source nix for current session
if [[ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]]; then
# shellcheck disable=SC1091
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
fi
# Install devbox if not present
if ! command -v devbox &>/dev/null; then
echo "==> Installing devbox..."
curl -fsSL https://get.jetify.com/devbox | bash -s -- -f
fi
# Set up devbox shellenv (only if nix is available)
if command -v nix &>/dev/null; then
eval "$(devbox global shellenv 2>/dev/null || true)"
fi
# Install chezmoi via devbox if not present
if ! command -v chezmoi &>/dev/null; then
echo "==> Installing chezmoi via devbox..."
devbox global add chezmoi
eval "$(devbox global shellenv)"
fi
# Apply dotfiles
echo "==> Applying dotfiles..."
if [[ -n "$BUSINESS_USE" ]]; then
BUSINESS_USE=1 chezmoi init --apply paveg/dots
else
chezmoi init --apply paveg/dots
fi
# Install the CLI tools declared by the rendered devbox global manifest.
# Must run after chezmoi apply, which is what writes that manifest.
echo "==> Installing CLI tools via devbox..."
if ! devbox global install; then
echo "!!! devbox global install failed."
echo "!!! The dotfiles are applied, but CLI tools are missing."
echo "!!! Re-run it manually: devbox global install"
fi
echo "==> Done! Restart your shell or run: exec zsh"