2024-03-06 14:17:11 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Make sure that the script exits if any command returns a non-zero exit code
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Define the path to the system configuration file
|
2024-03-06 14:47:41 +00:00
|
|
|
NIXOS_CONFIG_PATH="/etc/nixos"
|
2024-03-06 14:17:11 +00:00
|
|
|
|
|
|
|
echo "Checking for sudo access..."
|
|
|
|
# Ensure the script is being run with superuser privileges
|
|
|
|
sudo -v
|
|
|
|
|
|
|
|
echo "Copying new configuration..."
|
|
|
|
# Copy the local configuration.nix to the system configuration location
|
2024-03-15 07:21:36 +00:00
|
|
|
sudo cp ./configuration.nix "${NIXOS_CONFIG_PATH}"
|
|
|
|
sudo mkdir -p "${NIXOS_CONFIG_PATH}/private"
|
|
|
|
sudo cp ./private/* "${NIXOS_CONFIG_PATH}/private/"
|
2024-03-15 09:04:57 +00:00
|
|
|
sudo cp ./aliases.sh "${NIXOS_CONFIG_PATH}"
|
2024-03-06 14:17:11 +00:00
|
|
|
|
|
|
|
echo "Rebuilding NixOS configuration..."
|
|
|
|
# Rebuild the NixOS configuration and make the changes effective
|
|
|
|
sudo nixos-rebuild switch
|
|
|
|
|
|
|
|
echo "NixOS configuration updated successfully."
|