2024-02-27 15:42:27 +01:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
writeShellApplication,
|
|
|
|
}:
|
|
|
|
writeShellApplication
|
|
|
|
{
|
|
|
|
name = "install-nix";
|
|
|
|
|
|
|
|
runtimeInputs = [];
|
|
|
|
|
|
|
|
text = ''
|
|
|
|
# An install script for NixOS installation to /tmp
|
|
|
|
set -e
|
2024-02-29 15:02:42 +01:00
|
|
|
pushd /tmp > /dev/null
|
2024-02-29 14:52:12 +01:00
|
|
|
rm -rf ./install-nix
|
|
|
|
git clone https://git.lillianviolet.dev/Lillian-Violet/NixOS-Config.git ./install-nix
|
2024-02-29 15:02:42 +01:00
|
|
|
pushd ./install-nix/nixos/hosts > /dev/null
|
2024-02-28 11:01:48 +01:00
|
|
|
echo "Please choose the hostname you are installing to from the following list:"
|
|
|
|
i=1
|
|
|
|
for d in */
|
|
|
|
do
|
2024-02-29 14:45:07 +01:00
|
|
|
dirs[i++]="''${d%/}"
|
2024-02-28 11:01:48 +01:00
|
|
|
done
|
2024-02-29 14:45:07 +01:00
|
|
|
select dir in "''${dirs[@]}"; do echo "you selected ''${dir}"; break; done
|
2024-02-29 15:02:42 +01:00
|
|
|
popd > /dev/null
|
|
|
|
pushd ./install-nix > /dev/null
|
2024-02-27 15:42:27 +01:00
|
|
|
echo "NixOS Installing..."
|
2024-02-29 14:49:56 +01:00
|
|
|
sudo nixos-install --flake .#"''${dir}"
|
2024-02-29 15:02:42 +01:00
|
|
|
popd > /dev/null
|
2024-02-27 15:42:27 +01:00
|
|
|
echo "Cleaning up repository in tmp..."
|
2024-02-29 14:52:12 +01:00
|
|
|
rm -rf ./install-nix
|
2024-02-29 15:02:42 +01:00
|
|
|
popd > /dev/null
|
2024-02-27 15:42:27 +01:00
|
|
|
notify-send -e "NixOS Install Succeeded!" --icon=software-update-available
|
|
|
|
'';
|
|
|
|
}
|