feat: enhance Nix build and switch commands to support named and auto-detected hosts

Merged
SH
9mo ago
+19-3

Changes

  • Enhanced nix-build and nix-switch Makefile targets to support named host configuration via HOST variable
  • Added auto-detection support using DETECTED_HOST variable
  • Falls back to NIX_SYSTEM when neither HOST nor DETECTED_HOST is 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_SYSTEM usage
  • 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 HOST variable
  • Confirmed auto-detection works with DETECTED_HOST variable
  • Tested fallback to NIX_SYSTEM when 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.