This repository has been archived by the owner on Mar 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
bootstrap.sh
executable file
·66 lines (56 loc) · 1.7 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env bash
# Error Handling
set -euo pipefail
# Get Repository Root
RepoRoot="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Partition, Format, & Mount OS Disk
read -p "Do you want to format and mount the BOOT disk? This will erase the disk. (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
select fbd in "$RepoRoot"/scripts/format-boot_disk-*.sh; do
. "$fbd"
break
done
else
echo "Skipping Partitioning/Mounting"
echo "Script is proceeding with the assuption that /mnt is fully configured!!"
fi
# Custom or Default Deployment?
read -p "Do you want to use the configuration git repository? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
# Deploy Configuration Files
. "${RepoRoot}/scripts/deploy-config_files.sh"
# Generate users.nix (if custom config files were deployed)
echo "Select users.nix to generate."
select usrnix in "$RepoRoot"/scripts/generate-users-*.sh; do
. "$usrnix"
break
done
# Install System
echo "Installing NixOS!! This will take a while."
nixos-install --no-root-passwd
# Finished!!
echo; echo "All Done!! Shutdown, Remove Boot Media, and Enjoy!"
else
# Generate Default Configs
echo "Generating default config files at /mnt/etc/nixos/"
nixos-generate-config --root /mnt
# Review/Edit configuration.nix
read -p "Do you want to review/edit configuration.nix? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
vim /mnt/etc/nixos/configuration.nix
fi
# Review/Edit hardware_configuration.nix
read -p "Do you want to review/edit hardware_configuration.nix? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
vim /mnt/etc/nixos/hardware_configuration.nix
fi
# Install System
echo "Installing NixOS!! This will take a while."
nixos-install
fi