diff --git a/features/scripts/utils/nomarchy-sys-update b/features/scripts/utils/nomarchy-sys-update index cdbe83a..cb11f6e 100644 --- a/features/scripts/utils/nomarchy-sys-update +++ b/features/scripts/utils/nomarchy-sys-update @@ -15,8 +15,20 @@ else exit 1 fi -# Apply NixOS changes from the local flake -echo "Applying system-level changes from $REPO_DIR..." -sudo nixos-rebuild switch --flake "$REPO_DIR#default" --impure +# The installer generates `nixosConfigurations.` (see +# installer/install.sh: `nixosConfigurations.$HOSTNAME`), so the flake target +# must match the current host. The previous `#default` literal worked only +# for a development host that happened to be named "default" and silently +# broke every toggle script (nomarchy-tz-select, nomarchy-wifi-powersave, +# nomarchy-setup-{dns,fido2,fingerprint}, nomarchy-toggle-hybrid-gpu) on a +# real install. +HOSTNAME_ATTR=$(hostname) +if [ -z "$HOSTNAME_ATTR" ]; then + echo "Error: could not determine hostname for flake attribute." >&2 + exit 1 +fi + +echo "Applying system-level changes from $REPO_DIR#$HOSTNAME_ATTR..." +sudo nixos-rebuild switch --flake "$REPO_DIR#$HOSTNAME_ATTR" echo "System update complete."