Add build options for setting absolute paths to Nix libexec helpers - #16110
Open
PhilipTaronQ wants to merge 5 commits into
Open
PhilipTaronQ wants to merge 5 commits into
PhilipTaronQ wants to merge 5 commits into
Conversation
xokdvium
reviewed
Jul 7, 2026
xokdvium
reviewed
Jul 16, 2026
Ericson2314
reviewed
Sep 28, 2026
I added a new meson option `libfetchers:git-program` (default: `"git"`) which is threaded through all six `git` exec sites in `git.cc`/`git-utils.cc` via a generated `GIT_PROGRAM`, plus a public `gitProgram()` accessor used by the flake commit-lock-file path in `src/nix/flake.cc`. The binary named by this option is either resolved via PATH or an absolute path. Since the default is "git", today's behavior remains the default if this commit is merged. Motivation: distributions that bundle a known-good git (such as a macOS standalone package) need Nix to invoke it by absolute path instead of trusting PATH at run time. Assisted-by: Claude Code (Claude Opus 4.8)
I added a new meson option `libfetchers:hg-program` (default: `"hg"`) threaded through `hgOptions()` in `mercurial.cc` via a generated `HG_PROGRAM`, which every Mercurial exec site goes through. The binary named by this option is either resolved via PATH or an absolute path. Since the default is "hg", today's behavior remains the default if this commit is merged. Motivation: distributions that bundle a known-good Mercurial need Nix to invoke it by absolute path instead of trusting PATH at run time. Assisted-by: Claude Code (Claude Opus 5.5)
I added a new meson option `libstore:ssh-program` (default: `"ssh"`) threaded through SSHMaster's two exec sites via a generated `SSH_PROGRAM`. This is either a name resolved via PATH or an absolute path. Since the default is `"ssh"`, today's behavior persists. Motivation: distributions that bundle a known-good ssh need Nix to invoke it by absolute path instead of trusting PATH at run time. Assisted-by: Claude Code (Claude Opus 4.8)
I added a new meson option `libstore:lsof-program` (default: empty).
Empty keeps today's behavior. If it's empty, meson at build-time uses `find_program('lsof')` to find `lsof`, with a run-time PATH fallback.
On the other hand, a non-empty value for `libstore:lsof-program`` pins the `lsof` used by the garbage collector to find runtime roots.
We could likely do this better, but this works well enough for my purposes.
Assisted-by: Claude Code (Claude Opus 4.8)
I added a new meson option `nix:bash-program` (default: `"bash"`) threaded through the `interactive-shell` fallback in `nix develop` and `nix-shell` via a generated `FALLBACK_BASH` This is the shell used when bashInteractive from nixpkgs is unavailable. It's either a name resolved via PATH or an absolute path; since the default is "bash", today's behavior remains when this patch is merged. Motivation: distributions that bundle a known-good bash need Nix to invoke it by absolute path instead of trusting PATH at run time. Assisted-by: Claude Code (Claude Opus 4.8)
PhilipTaronQ
force-pushed
the
worktree-shell-out-build-time-configs
branch
from
September 28, 2026 15:14
e820329 to
29d2317
Compare
Contributor
Author
|
This is now ready for review and I hope merge. |
xokdvium
reviewed
Sep 28, 2026
Comment on lines
+242
to
+248
| lsof_program = get_option('lsof-program') | ||
| if lsof_program == '' | ||
| lsof = find_program('lsof', required : false) | ||
| # Just look up on the PATH if not found at build time | ||
| lsof_program = lsof.found() ? lsof.full_path() : 'lsof' | ||
| endif | ||
| configdata_priv.set_quoted('LSOF', lsof_program) |
Contributor
There was a problem hiding this comment.
Tbh I'm not sure the old behavior is correct and if this code is even exercised in any of nix builds but oh well. Since it's a pre-existing issue it's fine.
xokdvium
reviewed
Sep 28, 2026
Comment on lines
497
to
+498
| notice("uses bash from your environment"); | ||
| shell = "bash"; | ||
| shell = FALLBACK_BASH; |
Contributor
There was a problem hiding this comment.
The notice message seems to be a bit misleading now.
xokdvium
approved these changes
Sep 28, 2026
xokdvium
left a comment
Contributor
There was a problem hiding this comment.
Seems fine since it's not really changing any behavior. Unblocking your endeavors would be nice indeed.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Nix uses several binaries to do its work.
git.bash.hg.lsof.ssh. I'd like to bundle a known-good version of these tools, and bake that path into the binary, and I didn't have a tool other than patching Nix for doing so.Context
I'm looking to build stand-alone Nix which doesn't depend on the Nix store, but also doesn't just use whatever tools are in the path. That takes some discernment.
AI disclosure
I used Claude to help find the right incantations for Meson.
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.