Repository navigation
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·59 lines (52 loc) · 1.52 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·59 lines (52 loc) · 1.52 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
#!/usr/bin/env sh
set -e
case "$(uname -a)" in
Darwin*) os=macos;;
"Linux nixos"*) os=nixos;;
Linux*) os=linux;;
*) echo "ERROR: Unsupported OS"; exit 1;;
esac
has() {
[ -x "$(command -v "$1")" ]
}
if [ "$os" = macos ]; then
xcode-select --install
fi
if [ ! -d ~/dotfiles ]; then
clone='git clone https://github.com/mdwint/dotfiles.git ~/dotfiles'
if [ "$os" = nixos ]; then
nix-shell -p git --run "$clone"
else
$clone
fi
fi
(
cd ~/dotfiles
if [ "$os" = macos ]; then
if ! has nix; then
curl -fsSL https://install.determinate.systems/nix | sh -s -- install
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
sudo nix run nix-darwin/master#darwin-rebuild -- switch --flake .
fi
tic -x tmux/.tmux-terminfo.src
brew autoupdate start 43200 --cleanup --immediate
elif [ "$os" = nixos ]; then
sudo ln -sf ~/dotfiles/flake.nix /etc/nixos/
if [ -f /etc/nixos/hardware-configuration.nix ]; then
mkdir -p ~/dotfiles/nix/$HOSTNAME/
cp /etc/nixos/hardware-configuration.nix ~/dotfiles/nix/$HOSTNAME/
fi
sudo nixos-rebuild switch
sudo rm -f /etc/nixos/*configuration.nix
elif has stow; then
stow bin fish git neovim ripgrep tmux
fi
has nvim && nvim --headless '+Lazy! sync' +qa
)
if [ "$os" = macos ]; then
has uv && while read -r pkg; do uv tool install "$pkg" || true; done <<'EOF'
s3-pit-restore
tox
twine
EOF
fi