fix: nomarchy-sys-update targets actual hostname, not '#default'

The installer generates `nixosConfigurations.<hostname>` (see
installer/install.sh: `nixosConfigurations.$HOSTNAME`), but the system
update script was rebuilding `.#default` and using `--impure`. The
`#default` literal worked only on dev hosts that happened to be named
"default" and silently broke every toggle script on real installs.

Now resolves `$(hostname)` at runtime and aborts with a clear error if
empty. Dropped `--impure` — the flake doesn't need it.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Bernardo Magri
2026-05-18 17:01:22 +01:00
parent 098cd42ac8
commit ac4d66e54d

View File

@@ -15,8 +15,20 @@ else
exit 1 exit 1
fi fi
# Apply NixOS changes from the local flake # The installer generates `nixosConfigurations.<hostname>` (see
echo "Applying system-level changes from $REPO_DIR..." # installer/install.sh: `nixosConfigurations.$HOSTNAME`), so the flake target
sudo nixos-rebuild switch --flake "$REPO_DIR#default" --impure # 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." echo "System update complete."