added steps to the installation script so if it is interrupted, you dont have to restart
This commit is contained in:
@@ -14,12 +14,12 @@
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/91413e4e-538c-4266-8a4d-bf60ec83e7b9";
|
||||
{ device = "/dev/disk/by-partlabel/disk-main-root";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/nix" =
|
||||
{ device = "/dev/disk/by-uuid/aad759e2-6c39-4350-89b9-07f2bc6eb3cc";
|
||||
{ device = "/dev/disk/by-partlabel/disk-main-ESP";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/home";
|
||||
mountpoint = "/nix";
|
||||
};
|
||||
};
|
||||
root = {
|
||||
|
||||
@@ -1,7 +1,22 @@
|
||||
#!/run/current-system/sw/bin/bash
|
||||
echo "Welcome. This script will install pagedMov's NixOS configuration flake onto your machine."
|
||||
echo "If this script stops at any point, it will resume from the most recent major step when you call it again."
|
||||
echo "Call the script with --reset to restart the installation process"
|
||||
|
||||
set -e
|
||||
trap 'echo "Aborting installation."; exit 1' INT
|
||||
|
||||
if [ "$1" = "--reset" ]; then
|
||||
rm -rf /tmp/reset
|
||||
fi
|
||||
|
||||
if [ ! -f /tmp/install_steps ]; then
|
||||
echo "0" > /tmp/install_steps
|
||||
fi
|
||||
|
||||
install_step=$(cat /tmp/install_steps)
|
||||
|
||||
step_1() {
|
||||
# set up working directory
|
||||
mkdir -p /tmp/install_pwd && cd /tmp/install_pwd
|
||||
rm -rf ./*
|
||||
@@ -29,6 +44,7 @@ size=$((size-1))
|
||||
root_size_default=$(echo "scale=0;$size * 0.10 / 1" | bc)
|
||||
nix_size_default=$(echo "scale=0;$size * 0.35 / 1" | bc)
|
||||
|
||||
echo
|
||||
for part in "root" "nix"; do
|
||||
echo "You have $size GB remaining to work with on this drive. How big do you want your $part partition?"
|
||||
|
||||
@@ -38,6 +54,7 @@ for part in "root" "nix"; do
|
||||
echo "Default value is 35% of hard drive space ($nix_size_default GB)"
|
||||
fi
|
||||
echo "Give a positive integer or leave blank to use default value"
|
||||
echo
|
||||
deciding=true
|
||||
|
||||
while $deciding; do
|
||||
@@ -79,10 +96,12 @@ for part in "root" "nix"; do
|
||||
esac
|
||||
done
|
||||
|
||||
echo
|
||||
echo "Final partition sizes:"
|
||||
echo "root: $root_size GB"
|
||||
echo "nix: $nix_size GB"
|
||||
echo "home: $size GB"
|
||||
echo
|
||||
|
||||
sleep 1
|
||||
|
||||
@@ -94,24 +113,28 @@ mount /dev/disk/by-partlabel/disk-main-root /mnt
|
||||
mkdir -p /mnt/nix && mount /dev/disk/by-partlabel/disk-main-nix /mnt/nix
|
||||
mkdir -p /mnt/boot && mount /dev/disk/by-partlabel/disk-main-ESP /mnt/boot
|
||||
mkdir -p /mnt/home && mount /dev/disk/by-partlabel/disk-main-home /mnt/home
|
||||
}
|
||||
|
||||
step_2() {
|
||||
mkdir -p /mnt/etc
|
||||
cd /mnt/etc/
|
||||
[ -d /mnt/etc/nixos ] && rm -rf /mnt/etc/nixos
|
||||
if [ ! -d ./nixos ]; then
|
||||
git clone https://github.com/pagedMov/pagedmov-nix-cfg.git ./nixos
|
||||
|
||||
echo
|
||||
echo "Do you want to install the light or heavy configuration?"
|
||||
echo "Light configuration does not include gaming or virtualization features; intended for laptops, etc."
|
||||
echo "Heavy config includes gaming and virtualization features; intended for performant desktop environments."
|
||||
echo
|
||||
select config in "Heavy" "Light" "Quit"; do
|
||||
case $config in
|
||||
"Desktop")
|
||||
"Heavy")
|
||||
echo "Installing heavy configuration \`Oganesson\`"
|
||||
config="oganesson"
|
||||
sleep 0.5
|
||||
break
|
||||
;;
|
||||
"Laptop")
|
||||
"Light")
|
||||
echo "Installing light configuration \`Mercury\`"
|
||||
config="mercury"
|
||||
sleep 0.5
|
||||
@@ -128,14 +151,17 @@ select config in "Heavy" "Light" "Quit"; do
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
nixos-install --root /mnt --flake /mnt/etc/nixos#"$config" --no-root-password
|
||||
|
||||
echo
|
||||
echo "Preliminary installation successful!"
|
||||
echo "Adapting config to your setup..."
|
||||
echo "Beginning secondary installation phase..."
|
||||
echo
|
||||
}
|
||||
|
||||
step_3() {
|
||||
cp -r /mnt/etc/nixos /mnt/home/pagedmov/.sysflake
|
||||
rm -rf /mnt/etc/nixos
|
||||
ln -s /mnt/home/pagedmov/.sysflake /etc/nixos
|
||||
@@ -150,3 +176,19 @@ echo "INSTALLATION COMPLETE ! !" | toilet -f 3d -w 120 | lolcat -a -s 180
|
||||
echo "You can now reboot into your new system."
|
||||
echo "The system configuration flake will be found in your home folder under .sysflake"
|
||||
echo "/etc/nixos is a symlink leading to the .sysflake folder"
|
||||
}
|
||||
|
||||
next_step() {
|
||||
((install_step += 1))
|
||||
echo $install_step > /tmp/install_steps
|
||||
}
|
||||
|
||||
running=true
|
||||
while $running; do
|
||||
case $install_step in
|
||||
0) step_1;next_step;;
|
||||
1) step_2;next_step;;
|
||||
2) step_3;next_step;;
|
||||
3) step_4;next_step;;
|
||||
esac
|
||||
done
|
||||
|
||||
@@ -14,23 +14,23 @@
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/91413e4e-538c-4266-8a4d-bf60ec83e7b9";
|
||||
{ device = "/dev/disk/by-uuid/a843b14e-5e50-408d-9c23-c691c0efe46c";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/nix" =
|
||||
{ device = "/dev/disk/by-uuid/aad759e2-6c39-4350-89b9-07f2bc6eb3cc";
|
||||
{ device = "/dev/disk/by-uuid/fbf1f87a-5ed4-42bd-943d-67fae6e6537c";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "/dev/disk/by-uuid/F529-2C16";
|
||||
{ device = "/dev/disk/by-uuid/8BFD-57A2";
|
||||
fsType = "vfat";
|
||||
options = [ "fmask=0077" "dmask=0077" ];
|
||||
};
|
||||
|
||||
fileSystems."/home" =
|
||||
{ device = "/dev/disk/by-uuid/7edc690b-7e30-49d7-afbe-78354d0f7497";
|
||||
{ device = "/dev/disk/by-uuid/1a3c99c8-5c61-4253-8812-16c5985489f0";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user