Skip to content

headroom: init at 0.41.0 - #569784

Open
attilaolah wants to merge 1 commit into
NixOS:masterfrom
attilaolah:headroom-ai
Open

attilaolah wants to merge 1 commit into
NixOS:masterfrom
attilaolah:headroom-ai

Conversation

@attilaolah

@attilaolah attilaolah commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Add Headroom. Can be used both as a proxy via headroom proxy and as an MCP via headroom mcp serve.

The original attempt at packaging Headroom was in #529964, thanks for the inspiration.

Things done

  • Wrap it with the necessary tools to avoid binary downloads at runtime
  • Fetch Tiktoken encodings into the Nix store to prevent Headroom from fetching them on-the-fly
  • Try to get as much of the tests to run as I could

@nixpkgs-ci nixpkgs-ci Bot added the 6.topic: python Python is a high-level, general-purpose programming language. label Oct 3, 2026
@nixpkgs-ci nixpkgs-ci Bot added 8.has: package (new) This PR adds a new package 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. llm-assisted Contributions that include code generation with LLMs labels Oct 3, 2026
@attilaolah

This comment was marked as outdated.

@attilaolah

This comment was marked as outdated.

@attilaolah
attilaolah marked this pull request as ready for review October 3, 2026 14:03
@attilaolah

Copy link
Copy Markdown
Contributor Author

This should be ready for review now. I've been using this package for a little over a month now, on both NixOS and Darwin, both as a proxy and as an MCP server. So far no issues.

@attilaolah

Copy link
Copy Markdown
Contributor Author

@SuperSandro2000 you said in #529964 (comment) you might pick up Headroom, maybe you have some input here.

@nixpkgs-ci nixpkgs-ci Bot added 9.needs: reviewer This PR currently has no reviewers requested and needs attention. 7.no default reviewers This PR targets a package or module with no existing maintainers; roving reviewers, take pity! labels Oct 3, 2026
@attilaolah

Copy link
Copy Markdown
Contributor Author

@GraysonTinker I added you since you've already looked at #529964, but feel free to suggest someone else.

@nixpkgs-ci nixpkgs-ci Bot removed the 9.needs: reviewer This PR currently has no reviewers requested and needs attention. label Oct 5, 2026
@GraysonTinker

Copy link
Copy Markdown
Member

Will do when I get the chance, ouch that's a long derivation

@attilaolah

Copy link
Copy Markdown
Contributor Author

Thanks, and no rush at all. It is long indeed, much if it is about forcing the tests into the sandbox though…

@SuperSandro2000 SuperSandro2000 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I never got to the tests and then got distracted, but I prepared all the dependencies

Comment thread pkgs/development/python-modules/headroom-ai/default.nix Outdated
Comment thread pkgs/development/python-modules/headroom-ai/default.nix Outdated
Comment thread pkgs/development/python-modules/headroom-ai/default.nix Outdated
Comment thread pkgs/by-name/he/headroom/package.nix Outdated
Comment thread pkgs/development/python-modules/headroom-ai/default.nix Outdated
Comment thread pkgs/development/python-modules/headroom-ai/default.nix Outdated
Comment thread pkgs/development/python-modules/headroom-ai/default.nix Outdated
Comment thread pkgs/development/python-modules/headroom-ai/default.nix Outdated
@attilaolah

This comment was marked as outdated.

@attilaolah
attilaolah force-pushed the headroom-ai branch 4 times, most recently from e890ec2 to 81ac7cd Compare October 5, 2026 11:15
@attilaolah

This comment was marked as outdated.

@attilaolah

Copy link
Copy Markdown
Contributor Author

Looks like there are dynamic imports or similar in the tests, so a plain rm -rf headroom is not going to be enough.

@attilaolah

This comment was marked as outdated.

@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. and removed 6.topic: python Python is a high-level, general-purpose programming language. labels Oct 9, 2026
@attilaolah

This comment was marked as outdated.

@attilaolah

This comment was marked as outdated.

@attilaolah

attilaolah commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor Author

The move from python3Packages to top-level broke the headroom proxy command which re-execs Python and requires re-importing the headroom package.

Let me fix & verify that.


This fails on Darwin, but works on Linux:

nix run github:NixOS/nixpkgs/fc8c84a279555a6ce7f4f916bd4a17ffed224c9a#headroom -- proxy

@attilaolah
attilaolah marked this pull request as draft October 12, 2026 05:56
@attilaolah

Copy link
Copy Markdown
Contributor Author

The issue appears to be that Headroom on Darwin re-exec's Python to get a more efficient malloc, merged in headroomlabs-ai/headroom#2879.

On Linux this path is never taken so the binary executes normally. On Darwin, the re-exec fails due to $out remaining literal in the wrapper script, which I think was due to a missing ${placeholder "out"}.

I'm testing a fix now.

@attilaolah
attilaolah marked this pull request as ready for review October 12, 2026 08:42
@attilaolah

Copy link
Copy Markdown
Contributor Author

Confirmed b3dc24c, headroom proxy works on both Linux and macOS now.

@attilaolah

This comment was marked as outdated.

@attilaolah

This comment was marked as outdated.

@attilaolah

Copy link
Copy Markdown
Contributor Author

Version 0.41.0 is now out, I am testing it locally, will update this PR once confirmed working on Linux & Darwin.

Or, if merged in the meantime, then will post it as a normal update.

@attilaolah attilaolah changed the title headroom: init at 0.40.0 headroom: init at 0.41.0 Oct 16, 2026
@attilaolah

Copy link
Copy Markdown
Contributor Author

PR rebased & updated to 0.41.0.

  • Tested the new build on Linux, will test on Darwin when the build completes
  • This new version requires an additional patch to restore a module vs. exported name collision

This name collision apparently doesn't happen in Python 3.12, which is what upstream tests against. There are some efforts upstream to test against Python 3.14, but I'm not sure about the progress.

The targeted Pytest fixture patch allows tests to pass. The runtime issue is still present, but is import-order dependent, and as long as the normal headroom CLI doesn't trigger the "wrong" import order, it seems to be working fine.

@attilaolah

This comment was marked as outdated.

@attilaolah

This comment was marked as outdated.

@attilaolah

Copy link
Copy Markdown
Contributor Author
  • 5 new failures on Darwin, am working on those now
  • 2 previously deselected tests are no longer present upstream, cleanup coming soon

@attilaolah
attilaolah force-pushed the headroom-ai branch 2 times, most recently from 5657b95 to bbf61c7 Compare October 17, 2026 12:17
@attilaolah

Copy link
Copy Markdown
Contributor Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 569784
Commit: bbf61c790b44abe65be9c60665cfb0fa28f25767


aarch64-darwin

✅ 1 package built:
  • headroom

@attilaolah

Copy link
Copy Markdown
Contributor Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 569784
Commit: bbf61c790b44abe65be9c60665cfb0fa28f25767


x86_64-linux

✅ 1 package built:
  • headroom

@attilaolah

Copy link
Copy Markdown
Contributor Author

This is now broken since #575004. I'll attempt a fix, following the example in #578535.

https://github.com/headroomlabs-ai/headroom/releases/tag/v0.41.0

Assisted-by: OpenCode (GPT 5.6 Terra)
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
@attilaolah

Copy link
Copy Markdown
Contributor Author

Should be fixed now. Headroom pins mcp < 2 so I added the necessary scope override.

@attilaolah

Copy link
Copy Markdown
Contributor Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 569784
Commit: 17532b74898e31f81b09adc0645814569fdaf3c3


aarch64-darwin

✅ 1 package built:
  • headroom

@attilaolah

Copy link
Copy Markdown
Contributor Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 569784
Commit: 17532b74898e31f81b09adc0645814569fdaf3c3


x86_64-linux

✅ 1 package built:
  • headroom

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

7.no default reviewers This PR targets a package or module with no existing maintainers; roving reviewers, take pity! 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. llm-assisted Contributions that include code generation with LLMs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants