-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
41 lines (38 loc) · 1.44 KB
/
install.sh
File metadata and controls
41 lines (38 loc) · 1.44 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
SHELL_REPO="github:buurro/shell"
SCREENSHOTS_PATH="$HOME/Pictures/screenshots";
set -e
if [[ $OSTYPE == 'darwin'* ]]; then
if ! command -v brew &> /dev/null; then
echo "installing homebrew"
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
if ! command -v nix-env &> /dev/null; then
echo "installing nix"
sh <(curl -L https://nixos.org/nix/install)
zsh
fi
if [ ! -d "$SCREENSHOTS_PATH" ]; then
echo "creating screenshots directory"
mkdir -p "$SCREENSHOTS_PATH"
fi
cd /tmp
if ! command -v darwin-rebuild &> /dev/null; then
FLAKE="$SHELL_REPO#darwinConfigurations.$(hostname -s).system"
nix --experimental-features 'nix-command flakes' build "$FLAKE"
./result/sw/bin/darwin-rebuild switch --flake "$SHELL_REPO"
else
darwin-rebuild switch --flake "$SHELL_REPO"
fi
else
if ! command -v nix-env &> /dev/null; then
echo "installing nix"
sh <(curl -L https://nixos.org/nix/install) --daemon
fi
if ! command -v home-manager &> /dev/null; then
FLAKE="$SHELL_REPO#homeConfigurations.common.activationPackage"
nix --experimental-features 'nix-command flakes' build --no-link "$FLAKE"
"$(nix --experimental-features 'nix-command flakes' path-info $FLAKE)"/activate
else
home-manager switch --flake "$SHELL_REPO#common"
fi
fi