Skip to content

fix(makefile): honor detected NixOS host in CI builds - #2105

Merged
shunkakinoki merged 1 commit into
mainfrom
claude/github-actions-failures-14ef7d
Jul 18, 2026
Merged

fix(makefile): honor detected NixOS host in CI builds#2105
shunkakinoki merged 1 commit into
mainfrom
claude/github-actions-failures-14ef7d

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Problem

The Shell workflow is failing on main. Two shellspec cases in spec/make_build_host_resolution_spec.sh fail:

  • detects matic from Framework 13 AMD AI 300 DMI data when the hostname is generic
  • switches the detected matic host through the generic NixOS path

The CI branches of nix-build and nix-switch hardcoded the runner host for nixosConfigurations, ignoring both HOST and DETECTED_HOST. The Framework 13 DMI detection added in #2100 only wired into the non-CI branches, so it never took effect when CI=true. The specs run in CI, hit the hardcoded path, and got --flake .#runner instead of --flake .#matic.

The Darwin CI branch already resolved HOST / DETECTED_HOST correctly, which is why the other two cases in the same spec passed.

Change

Both CI branches now resolve HOST first, then DETECTED_HOST, and fall back to the existing hardcoded runner path when neither is set. Real CI runs set neither, so the runner behavior is unchanged there.

Verification

Reproduced the failure and confirmed the fix locally:

  • CI=true shellspec spec/make_build_host_resolution_spec.sh before the change: 4 examples, 2 failures
  • Same command after: 4 examples, 0 failures
  • Full suite CI=true shellspec: 1635 examples, 0 failures

Not addressed

The Docker workflow failure on main (run 29617921853) was a transient No space left on device while Nix built mise from source. Five subsequent Docker runs on main succeeded, so it is not a persistent breakage and is left alone here.


Summary by cubic

Fix CI builds to honor the detected NixOS host so the correct flake target is used. Removes the hardcoded runner path in nix-build and nix-switch CI branches, fixing the failing shellspec cases on main.

  • Bug Fixes
    • For nixosConfigurations, resolve HOST, then DETECTED_HOST; otherwise fall back to runner.
    • Use nixpkgs#nixos-rebuild with --flake .#<host> and set HOST/HOSTNAME accordingly.
    • Keeps default CI behavior when no host is set; Darwin path unchanged.

Written for commit 1dd9258. Summary will update on new commits.

Review in cubic

The CI branches of nix-build and nix-switch hardcoded the 'runner' host for
nixosConfigurations, ignoring both HOST and DETECTED_HOST. Framework 13 DMI
detection added in #2100 therefore never took effect under CI, failing the
make_build_host_resolution shellspec cases on main.

Both branches now resolve HOST, then DETECTED_HOST, and fall back to the
existing runner path when neither is set.
@indent-zero

indent-zero Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor
PR Summary

Fixes the CI branches of nix-build and nix-switch for nixosConfigurations, which were hardcoded to .#runner and ignored both HOST and the DMI-derived DETECTED_HOST. As a result, the Build Host matic step in .github/workflows/nix.yml was silently building the wrong flake attribute, and the Framework 13 DMI cases in spec/make_build_host_resolution_spec.sh (added in #2100) failed under CI=true. Both branches now use the same three-way HOSTDETECTED_HOSTrunner resolution already used in the non-CI paths and the Darwin CI branch.

  • nix-build CI nixosConfigurations branch now runs nixos-rebuild -- build --flake .#$(HOST) / .#$(DETECTED_HOST) before falling back to the historical runner build.
  • nix-switch CI nixosConfigurations branch now runs nixos-rebuild -- switch --flake .#$(HOST) / .#$(DETECTED_HOST) before falling back to the pre-existing "⏭️ NixOS switch skipped" runner path.
  • Runner fallback and its skip message remain unchanged, only reachable when both HOST and DETECTED_HOST are unset.

Issues

1 potential issue found:

  • The new CI nix-switch HOST and DETECTED_HOST branches inherit || exit 0 from the runner fallback, so a real nixos-rebuild switch failure on a named host will be silently swallowed and the recipe will report success — the non-CI equivalents at Makefile:743-748 intentionally let failures surface. Trigger: a self-hosted NixOS runner (e.g., the Framework 13 matic machine this PR is enabling) actually running make nix-switch with a broken switch. → Autofix

CI Checks

Waiting for CI checks...


⚡ Autofix All Issues

@cursor

cursor Bot commented Jul 18, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@mesa-dot-dev

mesa-dot-dev Bot commented Jul 18, 2026

Copy link
Copy Markdown

You do not have enough credits to review this pull request. Please purchase more credits to continue.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@shunkakinoki, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 53 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 88fdb589-06db-48f2-afba-02ec18b610f5

📥 Commits

Reviewing files that changed from the base of the PR and between af544b3 and 1dd9258.

📒 Files selected for processing (1)
  • Makefile
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/github-actions-failures-14ef7d

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the Makefile to support building and switching NixOS configurations for specific named (HOST) or auto-detected (DETECTED_HOST) hosts. The review feedback points out an inconsistency in the build commands where sudo and nixos-rebuild are unnecessarily used for building, which can cause permission issues and overhead in CI. It is recommended to use nix build directly, matching the existing fallback and Darwin branches.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread Makefile
Comment on lines +547 to +555
if [ -n "$(HOST)" ]; then \
echo "Building named NixOS host: $(HOST)"; \
$(SUDO) env HOST=$(HOST) HOSTNAME=$(HOST) $(NIX_ALLOW_UNFREE) $(NIX_EXEC) run $(NIX_FLAGS) nixpkgs#nixos-rebuild -- build --flake .#$(HOST) --impure; \
elif [ -n "$(DETECTED_HOST)" ]; then \
echo "Auto-detected host: $(DETECTED_HOST)"; \
$(SUDO) env HOST=$(DETECTED_HOST) HOSTNAME=$(DETECTED_HOST) $(NIX_ALLOW_UNFREE) $(NIX_EXEC) run $(NIX_FLAGS) nixpkgs#nixos-rebuild -- build --flake .#$(DETECTED_HOST) --impure; \
else \
HOST=runner HOSTNAME=runner $(NIX_ALLOW_UNFREE) $(NIX_EXEC) build .#nixosConfigurations.runner.config.system.build.toplevel $(NIX_FLAGS) --impure --no-update-lock-file --show-trace; \
fi; \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Inconsistency in CI NixOS Build Commands

There is a significant inconsistency in how NixOS configurations are built in CI:

  1. The Darwin CI branch (lines 528-545) and the Linux CI fallback branch (line 554) both use nix build .#nixosConfigurations.<host>.config.system.build.toplevel directly without sudo or nixos-rebuild.
  2. However, the newly added named and auto-detected host branches on Linux CI (lines 549 and 552) use $(SUDO) ... nixos-rebuild -- build via nix run nixpkgs#nixos-rebuild.

Using sudo and nixos-rebuild in CI for building (not switching) is problematic because:

  • Unnecessary Privileges: Building a Nix derivation does not require root privileges. Running build commands with sudo can cause permission issues in the workspace or build cache (e.g., root-owned files).
  • Overhead: Running nix run nixpkgs#nixos-rebuild downloads and evaluates nixos-rebuild from nixpkgs, adding unnecessary network dependency and overhead in CI.

Recommendation

Use nix build directly, matching the fallback and Darwin branches.

Note: Since the spec test spec/make_build_host_resolution_spec.sh (not in this diff) asserts on --flake .#matic, you will need to update it to expect .#nixosConfigurations.matic.config.system.build.toplevel instead.

			if [ -n "$(HOST)" ]; then \
				echo "Building named NixOS host: $(HOST)"; \
				HOST=$(HOST) HOSTNAME=$(HOST) $(NIX_ALLOW_UNFREE) $(NIX_EXEC) build .#nixosConfigurations.$(HOST).config.system.build.toplevel $(NIX_FLAGS) --impure --no-update-lock-file --show-trace; \
			elif [ -n "$(DETECTED_HOST)" ]; then \
				echo "Auto-detected host: $(DETECTED_HOST)"; \
				HOST=$(DETECTED_HOST) HOSTNAME=$(DETECTED_HOST) $(NIX_ALLOW_UNFREE) $(NIX_EXEC) build .#nixosConfigurations.$(DETECTED_HOST).config.system.build.toplevel $(NIX_FLAGS) --impure --no-update-lock-file --show-trace; \
			else \
				HOST=runner HOSTNAME=runner $(NIX_ALLOW_UNFREE) $(NIX_EXEC) build .#nixosConfigurations.runner.config.system.build.toplevel $(NIX_FLAGS) --impure --no-update-lock-file --show-trace; \
			fi; \

Comment thread Makefile
$(SUDO) env HOST=$(HOST) HOSTNAME=$(HOST) $(NIX_ALLOW_UNFREE) $(NIX_EXEC) run $(NIX_FLAGS) --impure nixpkgs#nixos-rebuild -- switch --flake .#$(HOST) --no-update-lock-file || exit 0; \
elif [ -n "$(DETECTED_HOST)" ]; then \
echo "Auto-detected host: $(DETECTED_HOST)"; \
$(SUDO) env HOST=$(DETECTED_HOST) HOSTNAME=$(DETECTED_HOST) $(NIX_ALLOW_UNFREE) $(NIX_EXEC) run $(NIX_FLAGS) --impure nixpkgs#nixos-rebuild -- switch --flake .#$(DETECTED_HOST) --no-update-lock-file || exit 0; \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Silent failure masking on real hosts in CI switch: The || exit 0 here is copied from the runner fallback (which needs it because CI runners aren't NixOS), but applying it to the HOST and DETECTED_HOST arms means a genuine nixos-rebuild switch failure on a named host will be swallowed and the Make recipe will still succeed. The non-CI equivalents at Makefile:743-748 deliberately don't do this. Not reachable today because ubuntu-latest can't switch NixOS anyway, but it becomes a real problem the moment a self-hosted NixOS runner (e.g., the Framework 13 matic machine this PR is enabling) runs make nix-switch. Consider dropping || exit 0 from the two HOST/DETECTED_HOST arms and keeping it only on the runner fallback.

@mesa-dot-dev

mesa-dot-dev Bot commented Jul 18, 2026

Copy link
Copy Markdown

Mesa Description

TL;DR

Honors the detected NixOS host configuration during CI builds, resolving shellspec workflow failures on main.

What changed?

  • Makefile: Updated the nix-build and nix-switch targets to dynamically select the NixOS configuration using the HOST or DETECTED_HOST environment variables, falling back to the default runner configuration.

Description generated by Mesa. Update settings

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 1 file

Re-trigger cubic

@shunkakinoki
shunkakinoki merged commit 80320ac into main Jul 18, 2026
31 checks passed
@shunkakinoki
shunkakinoki deleted the claude/github-actions-failures-14ef7d branch July 18, 2026 04:24
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.

1 participant