Skip to content

Nix/darwin followups - #9677

Open
nepet wants to merge 8 commits into
ElementsProject:masterfrom
nepet:nix/darwin-followups
Open

nepet wants to merge 8 commits into
ElementsProject:masterfrom
nepet:nix/darwin-followups

Conversation

@nepet

@nepet nepet commented Oct 28, 2026

Copy link
Copy Markdown
Member

Important

26.09 FREEZE August 5th: Non-bugfix PRs not ready by this date will wait for 26.12.

RC1 is scheduled on August 17th

The final release is scheduled for September 7th.

Checklist

Before submitting the PR, ensure the following tasks are completed. If an item is not applicable to your PR, please mark it as checked:

  • The changelog has been updated in the relevant commit(s) according to the guidelines.
  • Tests have been added or modified to reflect the changes.
  • Documentation has been reviewed and updated as needed.
  • Related issues have been listed and linked, including any that this PR closes.
  • Important All PRs must consider how to reverse any persistent changes for tools/lightning-downgrade

Builds on #9456. Only the last three commits are new.

On macOS, configure and the Makefile use /opt/homebrew on arm64 (and /usr/local otherwise), whether or not Homebrew is installed.

#9456 skips them in nix dev shells through IN_NIX_SHELL, but nix build doesn't set it. Darwin builds run without the nix sandbox by default, so on a Mac with Homebrew the package compiles with -I/opt/homebrew/include ahead of nix's -isystem paths: it uses Homebrew's sodium.h and gmp.h while linking nix's libsodium, which only works while the versions happen to match.

This PR changes to ask for Homebrew's prefix instead of hardcoding it. When brew isn't found, nothing from Homebrew is added. Not in a nix build, and not on a Mac without Homebrew. The IN_NIX_SHELL guard and the CPATH/LIBRARY_PATH overrides stay as they are.

This also fixes the Makefile in this case: don't print errors when openssl or git are missing. In a nix build, every make invocation printed openssl: command not found etc. Only stderr is silenced, the fuzz targets are still only included with OpenSSL >= 3.

Also, this switches to use nixpkgs lowdown-unsandboxed instead of patching lowdown. Nixpkgs already ships lowdown without its darwin sandbox and it's own nix package uses it on darwin. On Linux it's the same store path as lowdown.

niftynei and others added 8 commits October 29, 2026 09:43
Changelog-Added: nix: development shells now include `uv` for Python dependency and command execution.
Update paths in configure + Makefile so that nix develop works on a MacOS machine

Changelog-Fixed: nix: `nix develop` now configures and builds correctly on macOS without injecting Homebrew paths into the Nix toolchain.
We use `eatmydata` in the contrib/startup_regtest.sh shell script.
This automatically adds it to the nix development shell so it's available

Changelog-Added: nix: development shells now include `eatmydata` for `contrib/startup_regtest.sh`.
If you're running any startup_regtest daemons in the shell, this
will attempt to stop them on exit from the development shell.

Changelog-Added: nix: development shells now stop `startup_regtest.sh` daemons when the shell exits.
Add shellcheck to nix develop to complete checks without requiring a
separate host installation.

Changelog-Added: nix: development shells now include `shellcheck`.
On macOS, configure and the Makefile used /opt/homebrew on arm64 (and
/usr/local otherwise) whether or not Homebrew is installed. The nix dev
shell skips them through IN_NIX_SHELL, but `nix build` doesn't set it.
Darwin builds run without the nix sandbox by default, so on a Mac with
Homebrew the package compiled with -I/opt/homebrew/include ahead of
nix's -isystem paths: it used Homebrew's sodium.h and gmp.h while
linking nix's libsodium.

Ask `brew --prefix` instead, and use nothing from Homebrew when brew
isn't found. A nix build's PATH only holds the build's inputs, so it
gets no Homebrew paths, and neither does a Mac without Homebrew.

Changelog-Fixed: build: on macOS, Homebrew's headers and libraries are only used when Homebrew is installed, and no longer leak into `nix build`.
The Makefile runs `openssl version` and `git ls-files` while it is being
parsed. Where they are missing, as in a nix build, every make invocation
printed "openssl: command not found", "test: -ge: unary operator
expected" and "not a git repository" errors. Silence them; the fuzz
targets are still only included with OpenSSL >= 3.

Changelog-None
nixpkgs already ships lowdown built without its darwin sandbox
(enableDarwinSandbox = false) as lowdown-unsandboxed, and its own nix
package uses it on darwin for the same reason. It's in cache.nixos.org,
so darwin builds no longer compile lowdown locally, and the
--replace-fail on lowdown's main.c can't break on a future lowdown
update. On Linux it's the same package as lowdown.

Changelog-None
@nepet
nepet force-pushed the nix/darwin-followups branch from 3c74377 to 6f5d9e9 Compare October 29, 2026 08:43

This branch has not been deployed

No deployments
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.

2 participants