more stuff
This commit is contained in:
parent
5011ba465a
commit
975d396b48
1 changed files with 23 additions and 1 deletions
24
install.sh
24
install.sh
|
@ -141,15 +141,36 @@ install() {
|
||||||
sudo nixos-install --flake ".#$DOTNIX_HOSTNAME"
|
sudo nixos-install --flake ".#$DOTNIX_HOSTNAME"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
copy_files_to_new_install() {
|
||||||
|
username="$(grep user ./flake.nix | sed -e 's/.*\(.*\).*/\1/')"
|
||||||
|
cp -vr . /mnt/nix/config
|
||||||
|
mkdir -p "/mnt/nix/persist/home/$username/programming"
|
||||||
|
ln -svf /nix/config "/mnt/nix/persist/home/$username/programming/dotnix"
|
||||||
|
}
|
||||||
|
|
||||||
reboot_on_consent() {
|
reboot_on_consent() {
|
||||||
printf "\n\nWould you like to reboot?\n[y/n] > "
|
printf "\n\nInstallation finished. Would you like to reboot?\n[y/n] > "
|
||||||
read -r do_reboot
|
read -r do_reboot
|
||||||
if [ "$do_reboot" = "y" ] || [ "$do_reboot" = "Y" ]; then
|
if [ "$do_reboot" = "y" ] || [ "$do_reboot" = "Y" ]; then
|
||||||
sudo reboot
|
sudo reboot
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ensure_shell() {
|
||||||
|
if [ -z "$IN_NIX_SHELL" ]; then
|
||||||
|
echo "Restarting script in nix-shell environment."
|
||||||
|
exec nix-shell shell.nix --run "bash $0 $*"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
generate_age_keys() {
|
||||||
|
mkdir -vp ~/.config/sops/age
|
||||||
|
age-keygen -o ~/.config/sops/age/keys.txt
|
||||||
|
}
|
||||||
|
|
||||||
main () {
|
main () {
|
||||||
|
ensure_shell "$@"
|
||||||
|
|
||||||
args "$@"
|
args "$@"
|
||||||
permissions
|
permissions
|
||||||
|
|
||||||
|
@ -167,6 +188,7 @@ main () {
|
||||||
partition_disk
|
partition_disk
|
||||||
generate_config
|
generate_config
|
||||||
install
|
install
|
||||||
|
copy_files_to_new_install
|
||||||
reboot_on_consent
|
reboot_on_consent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue