packaging/nix-make: Rewrite the nushell builders in Python - #642
Conversation
compile.nu and link.nu become compile.py and link.py, and `postInstall` is now a Python snippet (with `out` and `os` bound). Python has the same advantage over bash for these builders (typed JSON for the structured attributes), and unlike nushell it has full POSIX process control, so the functional test runner can be written in it too, keeping all the build-system scripts in one language. As a side effect, compile.py creates the symlink tree of the includes with system calls rather than one `ln` process per include, which took ~100 ms per compilation unit. Assisted-by: Claude Fable 5.1 <noreply@anthropic.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (7)
💤 Files with no reviewable changes (2)
Included review availability: 3 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour. 📝 WalkthroughWalkthroughThe Nix make derivation helper and compilation and linking builders now use Python instead of Nushell. The Nix configuration invokes the Python builders and uses Python for a post-install symlink. Build guidance also updates the functional-test command and non-optimized build example. ChangesNix make Python builders
Build guidance
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to No newly introduced issue identified here prevents merging. The pkg-config flag limitation predates this change. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (3 skipped: 3 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
Motivation
The compile and link builders of the nix-make build (Nix as the C++ build system) were nushell scripts, chosen over bash because the structured attributes carry typed JSON (e.g.
nulland booleans indefines). Python has the same advantage, and unlike nushell it has full POSIX process control (signals, process groups, timeouts), which the functional test runner (tests/functional/run-tests.py) needs. Using Python for the builders too keeps all the build-system scripts in one language.Context
compile.nuandlink.nubecomecompile.pyandlink.pywith the same logic;mkNuDerivationinlib.nixbecomesmkPythonDerivation, andpostInstallis now a Python snippet (run withoutandosbound; the only user issrc/nix/make.nix).Measured on a real unit (116 includes), the builder's work before it execs the compiler drops from ~134 ms to ~28 ms: nushell has no
lnbuiltin, so it forked onelnprocess per include, whereas Python creates the symlinks with system calls. Interpreter startup is comparable (9 ms vs 13 ms). Note thatpython3Minimalships without bytecode caches, which makes it several times slower to start thanpython3, so the regularpython3is used.Verified by a full rebuild of
nix build ./packaging/nix-make#release.nixand bynix build ./packaging/nix-make#release.functional-tests(216 OK, 9 skipped).Also includes a small AGENTS.md improvement.
🤖 Generated with Claude Code
Summary by CodeRabbit
debug-fastconfiguration with clang and-O0.