Skip to content

fix: pin macOS host names per darwin configuration - #155

Merged
furedea merged 1 commit into
mainfrom
fix/pin-host-names-per-darwin-configuration
Oct 8, 2026
Merged

furedea merged 1 commit into
mainfrom
fix/pin-host-names-per-darwin-configuration

Conversation

@furedea

@furedea furedea commented Oct 8, 2026

Copy link
Copy Markdown
Owner

What changed

  • flake.nix: mkDarwinConfiguration takes a hostName (mbp, mba) and passes it through specialArgs.
  • nix/darwin/default.nix: sets networking.hostName, networking.localHostName, and networking.computerName from it. With HostName unset, macOS adopted the DHCP/reverse-DNS name of the current network, so the prompt showed mge on the university network.
  • nix/checks.nix: new host-names-pinned contract in host-configuration asserting the three names for both hosts.

Closes #154

Verification

  • nix build .#checks.aarch64-darwin.host-configuration: failed with host-names-pinned before the change (Red), passes after (Green).
  • Shared verification (verification_session.py verify): passed (bats 13 passed, pytest 3 passed).
  • deadnix and nixfmt --check on the edited files: clean. lefthook pre-commit and commitlint passed at commit time.
  • Not run: darwin-rebuild switch. Apply on each machine with sudo darwin-rebuild switch --flake .#mbp (or .#mba) and confirm scutil --get HostName.

Departures from the plan

None. Note that mba also gets its names pinned to mba so both hosts share the same mechanism.

🤖 Generated with Claude Code

With HostName unset, macOS adopts the DHCP/reverse-DNS name of the current network.

On the university network the prompt therefore showed mge instead of mbp.

Set networking.hostName, localHostName, and computerName per host via mkDarwinConfiguration.

A host-configuration contract guards the names of both hosts.

Refs #154

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 8, 2026 04:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@furedea
furedea merged commit fe13ca5 into main Oct 8, 2026
11 checks passed
@furedea
furedea deleted the fix/pin-host-names-per-darwin-configuration branch October 8, 2026 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pin macOS host names in the nix-darwin configurations

2 participants