Skip to content

fix(nixos): auto-detect matic host - #2100

Merged
shunkakinoki merged 1 commit into
mainfrom
codex/auto-detect-matic-host
Jul 17, 2026
Merged

fix(nixos): auto-detect matic host#2100
shunkakinoki merged 1 commit into
mainfrom
codex/auto-detect-matic-host

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • detect the Framework 13 AMD Ryzen AI 300 laptop as matic from DMI data when its current hostname is still generic
  • keep nix-switch fully generic and feed the detected host through the existing host-resolution path
  • document plain make build and make switch for matic while preserving HOST=matic as an override

Validation

  • shellspec spec/make_build_host_resolution_spec.sh (4 examples, 0 failures)
  • make shell-test (1,635 ShellSpec examples and 414 fish tests, 0 failures)
  • git diff --check

Note

make nix-format-check could not reach the host Nix daemon from the Codex sandbox. No Nix files are changed by this PR.


Summary by cubic

Auto-detect the matic host on Framework Laptop 13 (AMD Ryzen AI 300 Series) using DMI so machines with a generic hostname pick the right config. make build and make switch now work without HOST=matic; the generic host-resolution and nix-switch flow is unchanged, and the override still works.

Written for commit afe22d8. Summary will update on new commits.

Review in cubic

@indent-zero

indent-zero Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor
PR Summary

Adds auto-detection for the matic NixOS host based on Framework 13 AMD Ryzen AI 300 DMI identifiers so make build / make switch work without HOST=matic, including from recovery generations with a generic hostname. Detection is gated after existing hostname and HOST= checks, so no other host paths change.

  • Add DMI_SYS_VENDOR and DMI_PRODUCT_NAME Makefile variables sourced from /sys/class/dmi/id/* with ?= for test/CLI overrides.
  • Extend the Linux DETECTED_HOST block to map sys_vendor=Framework + product name matching Laptop 13.*AMD Ryzen AI 300 to matic.
  • Update named-hosts/matic/README.md to promote make build / make switch and document HOST=matic as an explicit override.
  • Add two shellspec cases in spec/make_build_host_resolution_spec.sh covering both nix-build and nix-switch on the new DMI-driven path.

Issues

2 potential issues found:

  • echo "$(DMI_PRODUCT_NAME)" | grep -q ... can misbehave if the DMI string ever starts with -n/-e or contains backslashes; swap to printf '%s\n' "$(DMI_PRODUCT_NAME)" | grep -q ... for portable behavior. → Autofix
  • DMI product-name match is a hardcoded substring (Laptop 13.*AMD Ryzen AI 300); if Framework changes the SKU string in a future BIOS, auto-detection silently reverts to requiring HOST=matic. Worth pinning to the exact observed value or adding a comment noting where the string comes from. → Autofix

CI Checks

Waiting for CI checks...


⚡ Autofix All Issues

@cursor

cursor Bot commented Jul 17, 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 17, 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 17, 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: 36 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: c9bf97d1-974f-47ae-aee2-4b3b6b68ce92

📥 Commits

Reviewing files that changed from the base of the PR and between e1168c4 and afe22d8.

📒 Files selected for processing (3)
  • Makefile
  • named-hosts/matic/README.md
  • spec/make_build_host_resolution_spec.sh
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/auto-detect-matic-host

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.

@shunkakinoki
shunkakinoki merged commit a58ced5 into main Jul 17, 2026
27 of 29 checks passed
@shunkakinoki
shunkakinoki deleted the codex/auto-detect-matic-host branch July 17, 2026 23:50

@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 introduces automatic host detection for the "matic" host (a Framework 13 AMD Ryzen AI 300 laptop) by reading DMI system vendor and product name values in the Makefile, removing the need to explicitly pass HOST=matic during builds and switches. It also updates the documentation and adds corresponding tests. The feedback suggests using printf instead of echo when processing DMI_PRODUCT_NAME to avoid unexpected behavior with arbitrary system strings.

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 +111 to +113
elif [ "$(DMI_SYS_VENDOR)" = "Framework" ] \
&& echo "$(DMI_PRODUCT_NAME)" | grep -q "Laptop 13.*AMD Ryzen AI 300"; then \
echo "matic"; \

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

Using echo to print variables that can contain arbitrary system or user input (such as DMI_PRODUCT_NAME) can lead to unexpected behavior if the value starts with a hyphen (interpreted as an option like -n) or contains backslashes. It is safer and more robust to use printf '%s\n' instead of echo.

			elif [ "$(DMI_SYS_VENDOR)" = "Framework" ] \
				&& printf '%s\n' "$(DMI_PRODUCT_NAME)" | grep -q "Laptop 13.*AMD Ryzen AI 300"; then \
				echo "matic"; \

Comment thread Makefile
elif [ "$$hostname" = "matic" ]; then \
echo "matic"; \
elif [ "$(DMI_SYS_VENDOR)" = "Framework" ] \
&& echo "$(DMI_PRODUCT_NAME)" | grep -q "Laptop 13.*AMD Ryzen AI 300"; then \

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.

DMI product-name match is a moving target: grep -q "Laptop 13.*AMD Ryzen AI 300" matches the current Framework AMD 300 DMI string (Laptop 13 (AMD Ryzen AI 300 Series)), but a future Framework BIOS or SKU rename would silently disable auto-detection — make build would still work with HOST=matic, but the auto-detect UX advertised in the README would quietly regress. Consider pinning the exact expected value (or leaving a comment pointing at the source of truth in nixos-hardware) so a future mismatch surfaces as an obvious diff rather than a silent behavior change.

Comment thread Makefile
elif [ "$$hostname" = "matic" ]; then \
echo "matic"; \
elif [ "$(DMI_SYS_VENDOR)" = "Framework" ] \
&& echo "$(DMI_PRODUCT_NAME)" | grep -q "Laptop 13.*AMD Ryzen AI 300"; then \

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.

Prefer printf over echo for arbitrary values: echo builtin behavior differs across shells when the argument starts with -n/-e or contains backslashes. DMI_PRODUCT_NAME is kernel-provided so this is unlikely in practice, but printf '%s\n' "$(DMI_PRODUCT_NAME)" | grep -q "Laptop 13.*AMD Ryzen AI 300" is the standard, portable form and matches the rest of the shell in this Makefile.

Suggested change
&& echo "$(DMI_PRODUCT_NAME)" | grep -q "Laptop 13.*AMD Ryzen AI 300"; then \
elif [ "$(DMI_SYS_VENDOR)" = "Framework" ] \
&& printf '%s\n' "$(DMI_PRODUCT_NAME)" | grep -q "Laptop 13.*AMD Ryzen AI 300"; then \

@mesa-dot-dev

mesa-dot-dev Bot commented Jul 17, 2026

Copy link
Copy Markdown

Mesa Description

TL;DR

Automatically detects Framework Laptop 13 (AMD Ryzen AI 300) as the matic host using DMI data when the system hostname is generic, allowing for simplified build and switch commands.

What changed?

  • Makefile: Extracts system vendor and product name from DMI properties to automatically resolve the target host to matic on supported Framework 13 hardware.
  • named-hosts/matic/README.md: Documents the new automatic detection behavior and updates recommended build/switch commands, while preserving the manual HOST=matic override instructions.
  • spec/make_build_host_resolution_spec.sh: Adds unit test coverage to verify that the matic build host is correctly resolved on matching mocked hardware when the system hostname is generic.

Description generated by Mesa. Update settings

shunkakinoki added a commit that referenced this pull request Jul 18, 2026
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.
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