-
Notifications
You must be signed in to change notification settings - Fork 1
/
bootstrap.sh
executable file
·47 lines (41 loc) · 1.43 KB
/
bootstrap.sh
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
#!/usr/bin/env bash
set -euo pipefail
echo "Running the initial set up of the system..."
REPO_ROOT=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "Setting symlinks to point to $REPO_ROOT"
echo "Which machine are we setting up?"
MACHINES=("Desktop" "Dell" "New System" "Exit")
select MACHINE in "${MACHINES[@]}"; do
case $MACHINE in
"Desktop")
echo "Setting configuration.nix symlink"
sudo rm -f /etc/nixos/configuration.nix || true
sudo rm -f /etc/nixos/hardware-configuration.nix || true
sudo ln -s "$REPO_ROOT"/desktop.nix /etc/nixos/configuration.nix
break
;;
"Dell")
echo "Setting configuration.nix symlink"
sudo rm -f /etc/nixos/configuration.nix || true
sudo rm -f /etc/nixos/hardware-configuration.nix || true
sudo ln -s "$REPO_ROOT"/dell.nix /etc/nixos/configuration.nix
break
;;
"New System")
echo "Skipping setting up hardware/profile config symlinks"
break
;;
"Exit")
echo "Cancelling setup"
exit
;;
*) echo -e "Invalid selection. Please try again";;
esac
done
echo "Setting up channels"
sudo nix-channel --add https://nixos.org/channels/nixos-24.11 nixos
sudo nix-channel --add https://github.com/nix-community/home-manager/archive/release-24.11.tar.gz home-manager
sudo nix-channel --update
echo "Rebuilding the OS"
sudo nixos-rebuild boot
echo "All done! Reboot to use updated config"