2024-03-05 15:34:12 +01:00
|
|
|
{
|
2024-03-23 14:57:52 +01:00
|
|
|
git,
|
|
|
|
gum,
|
2024-03-05 15:34:12 +01:00
|
|
|
writeShellApplication,
|
|
|
|
}:
|
|
|
|
writeShellApplication
|
|
|
|
{
|
|
|
|
name = "install-nix-no-inhibit";
|
|
|
|
|
2024-03-20 19:50:29 +01:00
|
|
|
runtimeInputs = [git gum];
|
2024-03-05 15:34:12 +01:00
|
|
|
|
|
|
|
text = ''
|
|
|
|
# An install script for NixOS installation to /tmp
|
|
|
|
set -e
|
|
|
|
pushd /tmp > /dev/null
|
2024-03-24 18:49:15 +01:00
|
|
|
rm -rf ./install-nix
|
2024-05-06 15:55:51 +02:00
|
|
|
git clone https://codeberg.org/Lillian-Violet/NixOS-Config.git ./install-nix
|
2024-03-05 15:34:12 +01:00
|
|
|
pushd ./install-nix/nixos/hosts > /dev/null
|
|
|
|
echo "Please choose the hostname you are installing to from the following list:"
|
|
|
|
i=1
|
|
|
|
for d in */
|
|
|
|
do
|
|
|
|
dirs[i++]="''${d%/}"
|
|
|
|
done
|
|
|
|
select dir in "''${dirs[@]}"; do echo "you selected ''${dir}"; break; done
|
|
|
|
popd > /dev/null
|
|
|
|
pushd ./install-nix > /dev/null
|
2024-03-20 19:50:29 +01:00
|
|
|
gum confirm --default=false \
|
|
|
|
"🔥 🔥 🔥 WARNING!!!! This will ERASE ALL DATA on the disk for ''${dir}. Are you sure you want to continue?"
|
|
|
|
|
|
|
|
echo "Partitioning Disks"
|
|
|
|
sudo nix run github:nix-community/disko \
|
|
|
|
--extra-experimental-features "nix-command flakes" \
|
|
|
|
--no-write-lock-file \
|
|
|
|
-- \
|
|
|
|
--mode zap_create_mount \
|
|
|
|
"./disko/''${dir}/default.nix"
|
2024-03-05 15:34:12 +01:00
|
|
|
echo "NixOS Installing..."
|
2024-03-24 18:49:15 +01:00
|
|
|
sudo nixos-install --flake .#"''${dir}"
|
2024-05-06 15:55:51 +02:00
|
|
|
sudo nixos-install --flake .#"''${dir}"
|
2024-03-05 15:34:12 +01:00
|
|
|
popd > /dev/null
|
|
|
|
echo "Cleaning up repository in '/tmp/install-nix'..."
|
2024-03-24 18:49:15 +01:00
|
|
|
rm -rf ./install-nix
|
2024-05-06 15:55:51 +02:00
|
|
|
rm -rf ./install-nix
|
2024-03-05 15:34:12 +01:00
|
|
|
popd > /dev/null
|
|
|
|
echo "NixOS Install Succeeded!"
|
|
|
|
'';
|
|
|
|
}
|