diff --git a/lib/scripts/install.sh b/lib/scripts/install.sh index ae76193..1e50098 100755 --- a/lib/scripts/install.sh +++ b/lib/scripts/install.sh @@ -3,6 +3,7 @@ set -o errexit set -o nounset set -o pipefail +set -x check_root() { if [[ "${EUID}" -ne 0 ]]; then @@ -116,6 +117,17 @@ copy_keys() { done } +copy_config() { + echo "Would you like to copy the current configuration (including keys) to the target system? [y/N]" + read -r copy_config + + if [[ "${copy_config}" =~ ^([yY][eE][sS]|[yY])$ ]]; then + rm -rf /mnt/etc/nixos + cp -r . /mnt/etc/nixos + echo "Configuration copied successfully." + fi +} + install() { nixos-install --root /mnt --flake ".#${host}" } @@ -135,6 +147,7 @@ main() { prepare_disk "disko" copy_keys install + copy_config echo "Installation complete. Please reboot your system." ;; 2)