feat: Use a systemd service to run the update-system command

This commit is contained in:
2025-12-11 12:11:23 -05:00
committed by Hunter Halloran
parent e7d7218c79
commit ac8559e00b
2 changed files with 99 additions and 16 deletions

View File

@@ -22,6 +22,7 @@ in
imports = [
./python.nix
./ghostty.nix
./shared-services.nix
];
options.modules.sw = {
@@ -74,22 +75,6 @@ in
oh-my-posh
inputs.lazyvim-nixvim.packages.${stdenv.hostPlatform.system}.nvim
inputs.agenix.packages.${stdenv.hostPlatform.system}.default
# Custom update script
(writeShellScriptBin "update-system" ''
HOSTNAME=$(hostname)
FLAKE_URI="github:UGA-Innovation-Factory/nixos-systems"
# Pass arguments like --impure to nixos-rebuild
EXTRA_ARGS="$@"
if [[ "$HOSTNAME" == nix-surface* ]]; then
echo "Detected Surface tablet. Using remote build host."
sudo nixos-rebuild switch --flake "$FLAKE_URI" --build-host engr-ugaif@192.168.11.133 --refresh $EXTRA_ARGS
else
echo "Updating local system..."
sudo nixos-rebuild switch --flake "$FLAKE_URI" --refresh $EXTRA_ARGS
fi
'')
];
}
# Import Desktop or Kiosk modules based on type