nix-setup/init.sh
2024-10-21 17:40:52 +02:00

43 lines
1.1 KiB
Bash

#!/bin/sh
echo "this is meant to be run from the iso!!!"
if [ -e "/mnt/etc/nixos" ] ; then
echo "iso detected. continue!"
else
echo "you don't appear to be in the install iso."
echo -n "are you SURE??? (y/N) "
read sure
if ! [ "$sure" = "y" ] ; then
echo "ok. exiting."
exit 0
fi
echo "i will continue."
fi
echo "> setting up channels:"
echo deleting old
nix-channel --remove nixos
echo adding os channel
nix-channel --add "https://channels.nixos.org/nixos-unstable" nixos
echo adding pkgs channel
nix-channel --add "https://channels.nixos.org/nixpkgs-unstable" nixpkgs
echo updating
nix-channel --update
echo "> all set."
echo
echo "you can now do the following to finish setup:"
echo " 1. reboot the system"
echo " 2. open tty1 and login as root"
echo " 3. run nixos-edit init"
echo " 4. finish setup for tudbut user"
echo " 5. login on tty7"
echo " 6. go back to tty1 and do what nixos-edit tells you"
echo
echo -n "do you want to install and reboot now? [Y/n] "
read yn
if [ "$yn" != n ] ; then
nixos-install || exit 1
echo "rebooting"
sleep 1
reboot
fi