NixOS-Config/pkgs/install-nix/default.nix

36 lines
826 B
Nix
Raw Normal View History

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
pushd /tmp
git clone https://git.lillianviolet.dev/Lillian-Violet/NixOS-Config.git ./install
pushd ./install/nixos/hosts
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
2024-02-27 15:42:27 +01:00
pushd ./install
echo "NixOS Installing..."
sudo nixos-install --flake .#$dir
2024-02-27 15:42:27 +01:00
popd
echo "Cleaning up repository in tmp..."
rm -rf ./install
popd
notify-send -e "NixOS Install Succeeded!" --icon=software-update-available
'';
}