feat: enhance Nix build and switch commands to support named and auto-detected hosts
Merged
SH
9mo ago+19+19+01234567890123456789-3-3-0123456789
Changes
- Enhanced
nix-buildandnix-switchMakefile targets to support named host configuration viaHOSTvariable - Added auto-detection support using
DETECTED_HOSTvariable - Falls back to
NIX_SYSTEMwhen neitherHOSTnorDETECTED_HOSTis set - Added informational echo statements to display which host is being built/switched
- Updated dotagents submodule
Technical Details
The changes improve flexibility in building and switching Nix configurations by:
- Prioritizing explicitly named hosts (
HOST) for targeted builds - Supporting auto-detected hosts (
DETECTED_HOST) for convenience - Maintaining backward compatibility with existing
NIX_SYSTEMusage - Providing clear console output for debugging and transparency
Both nix-build and nix-switch targets now follow the same host resolution logic, ensuring consistency between build and activation workflows.
Testing
- Verified host selection logic with
HOSTvariable - Confirmed auto-detection works with
DETECTED_HOSTvariable - Tested fallback to
NIX_SYSTEMwhen both variables are unset - Validated informational output displays correctly for all scenarios
Generated with Claude Code by glm-4.7
Summary by cubic
Add host selection to nix-build and nix-switch using HOST and DETECTED_HOST, with fallback to NIX_SYSTEM and clearer logs. This makes targeted builds/switches easier and keeps behavior consistent.
-
New Features
- Host resolution order: HOST → DETECTED_HOST → NIX_SYSTEM.
- Echo which host is being built/switched.
- Same host logic for both build and switch targets.
-
Dependencies
- Updated dotagents submodule.