#!/bin/bash set -e VM_NAME="nixos" VM_IP=$(sudo virsh domifaddr "$VM_NAME" | awk '/ipv4/ {print $4}' | cut -d'/' -f1) USER="root" PASSWORD="asdf" # function for printing error messages in yellow eprint() { echo -e "\033[1;33m$1\033[0m" } echo "IP: $VM_IP" # FILES=( # "configuration.nix" # "flake.nix" # "hardware-configuration.nix" # ) # for FILE in "${FILES[@]}"; do # if [ -f "$FILE" ]; then # echo "Uploading $FILE to $VM_IP..." # sshpass -p "$PASSWORD" scp "$FILE" "$USER@$VM_IP:/etc/nixos/$FILE" # else # eprint "Warning: $FILE does not exist, skipping upload." # fi # done # Synchronize the NixOS configuration with rsync sshpass -p "$PASSWORD" rsync -avz new/ "$USER@$VM_IP:/etc/nixos/new"