Repository navigation
Nix/darwin followups - #9677
Nix/darwin followups#9677
Conversation
3c74377 to
6f5d9e9
Compare
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
6f5d9e9 to
8e5b90d
Compare
|
I was testing this on my machine (linux x86_64) and i had to change Nix provides SQLite 3.50.4, and my machine has 3.54.0 in This fixed it for me: diff --git a/configure b/configure
index 5279246364..2e8d39e55f 100755
--- a/configure
+++ b/configure
@@ -444,7 +444,8 @@ fi
POSTGRES_INCLUDE=""
POSTGRES_LDLIBS=""
if command -v "${PG_CONFIG}" >/dev/null; then
- POSTGRES_INCLUDE="-I$("${PG_CONFIG}" --includedir)"
+ # -idirafter: never shadow headers from -I or -isystem paths (e.g. Nix's sqlite3.h).
+ POSTGRES_INCLUDE="-idirafter $("${PG_CONFIG}" --includedir)"
POSTGRES_LDLIBS="-L$("${PG_CONFIG}" --libdir) -lpq"
fiEDIT: made the fix more general |
The default dev shell has no postgres, so configure found the host's pg_config on PATH and added its include and lib dirs. On Linux that is -I/usr/include, which put the host's sqlite3.h (3.54) ahead of nix's (3.50). On a Mac with Homebrew it linked Homebrew's libpq. Set PG_CONFIG to the empty string, which configure takes as "postgres disabled". The postgres dev shell is unchanged and uses nix's pg_config. Reported-by: daywalker90 Changelog-None
|
Thanks @daywalker90, good catch. The root cause is that the default dev shell has no postgres, so configure falls back to the host's I went with a different fix than
So I pushed 62fc81c, which sets |
|
Even better, and works too, thanks! |
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:
tools/lightning-downgradeBuilds on #9456. Only the last three commits are new.
On macOS,
configureand theMakefileuse/opt/homebrewon arm64 (and/usr/localotherwise), whether or not Homebrew is installed.#9456 skips them in nix dev shells through
IN_NIX_SHELL, butnix builddoesn'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/includeahead of nix's-isystempaths: it uses Homebrew'ssodium.handgmp.hwhile linking nix'slibsodium, which only works while the versions happen to match.This PR changes to ask for Homebrew's prefix instead of hardcoding it. When
brewisn't found, nothing from Homebrew is added. Not in a nix build, and not on a Mac without Homebrew. TheIN_NIX_SHELLguard and theCPATH/LIBRARY_PATHoverrides stay as they are.This also fixes the Makefile in this case: don't print errors when
opensslorgitare missing. In a nix build, everymakeinvocation printedopenssl: command not foundetc. Only stderr is silenced, the fuzz targets are still only included with OpenSSL >= 3.Also, this switches to use nixpkgs
lowdown-unsandboxedinstead of patchinglowdown. Nixpkgs already ships lowdown without its darwin sandbox and it's ownnixpackage uses it on darwin. On Linux it's the same store path aslowdown.