-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·37 lines (29 loc) · 1.14 KB
/
Copy pathbootstrap.sh
File metadata and controls
executable file
·37 lines (29 loc) · 1.14 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
#!/bin/bash
# A simple script to bootstrap the dotfiles installation
set -e
# Check if Nix is installed
if ! command -v nix &>/dev/null; then
echo "Nix is not installed. Installing now..."
sh <(curl -L https://nixos.org/nix/install)
# Source nix
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
else
echo "Nix is already installed."
fi
# Enable experimental features
export NIX_CONFIG="experimental-features = nix-command flakes"
# Clone repository if not already there
DOTFILES_DIR="$HOME/.dotfiles"
if [ ! -d "$DOTFILES_DIR" ]; then
echo "Cloning dotfiles repository..."
git clone https://github.com/mikesplain/dotfiles.git "$DOTFILES_DIR"
fi
# Enter the dotfiles directory
cd "$DOTFILES_DIR"
# Run the darwin installer
echo "Installing nix-darwin configuration..."
nix run nix-darwin --extra-experimental-features nix-command --extra-experimental-features flakes -- switch --flake .
echo "Installation complete! Your system has been configured."
echo "Run 'darwin-rebuild switch --flake ~/.dotfiles' to update your configuration in the future."