Skip to content

Fix missing dependencies in flake for make - #8950

Merged
nepet merged 6 commits into
ElementsProject:masterfrom
ekzyis:fix-missing-deps-in-flake-for-make
Oct 28, 2026
Merged

nepet merged 6 commits into
ElementsProject:masterfrom
ekzyis:fix-missing-deps-in-flake-for-make

Conversation

@ekzyis

@ekzyis ekzyis commented Mar 19, 2026 •

Copy link
Copy Markdown
Contributor

Important

26.04 FREEZE March 11th: Non-bugfix PRs not ready by this date will wait for 26.06.

RC1 is scheduled on March 23rd

The final release is scheduled for April 15th.

I followed the developer guide. On 13608c5, I get the following error after running nix develop, ./configure and then make:

tests/fuzz/fuzz-hmac-sha256.c:8:10: fatal error: openssl/evp.h: No such file or directory

After adding openssl, without protobuf, make fails while building cln-grpc v0.5.0 because the protoc binary is missing:

error: failed to run custom build command for `cln-grpc v0.5.0 (/home/ekzyis/prog/c-lightning/cln-grpc)`

Caused by:
  process didn't exit successfully: `/home/ekzyis/prog/c-lightning/target/debug/build/cln-grpc-cafbb5a40c9ead3e/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-changed=proto/node.proto
  cargo:rerun-if-changed=proto

  --- stderr

  thread 'main' (219469) panicked at cln-grpc/build.rs:7:10:
  called `Result::unwrap()` on an `Err` value: Custom { kind: NotFound, error: "Could not find `protoc`. If `protoc` is installed, try setting the `PROTOC` environment variable to the path of the `protoc` binary. To install it on Debian, run `apt-get install protobuf-compiler`. It is also available at https://github.com/protocolbuffers/protobuf/releases  For more information: https://docs.rs/prost-build/#sourcing-protoc" }

This PR fixes this by adding the missing dependencies to the flake.

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

Changelog-None

ekzyis added 2 commits March 19, 2026 17:09
Running `nix develop`, `./configure` and then `make` fails with this error:

```
tests/fuzz/fuzz-hmac-sha256.c:8:10: fatal error: openssl/evp.h: No such file or directory
```

After adding `openssl`, without `protobuf`, `make` fails while building
`cln-grpc v0.5.0` because the `protoc` binary is missing.
also include uv in nix develop shell to run tests
@ekzyis
ekzyis force-pushed the fix-missing-deps-in-flake-for-make branch from 2c9d669 to cc462d3 Compare March 19, 2026 16:09
@ekzyis

ekzyis commented Mar 19, 2026

Copy link
Copy Markdown
Contributor Author

I think the CI errors are unrelated:

ccan/tools/configurator/configurator: Test for HAVE_BIG_ENDIAN did not compile:
ld: warning: reexported library with install name '/opt/homebrew/opt/llvm@15/lib/libunwind.1.dylib' found at '/opt/homebrew/Cellar/llvm@15/15.0.7/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly

FAILED tests/test_plugin.py::test_channel_state_changed_unilateral - TimeoutError: Unable to find "[re.compile('Server started with public key')]" in logs.

nepet added 4 commits October 28, 2026 10:36
cln-grpc stopped looking for protoc on PATH in 608f695 ("cln-grpc:
vendor protoc as a build-dependency"): its build script now uses the
statically linked protoc from protoc-bin-vendored, which also runs on
NixOS. Nothing else in the build calls protoc; the Python bindings use
grpc_tools.protoc.

Changelog-None
Only the fuzz targets include OpenSSL headers, and make compiles them
only when `openssl version` reports 3 or later. A package in
buildInputs also puts its binary on PATH, so with openssl in the
package, `nix build` would compile the fuzz targets as well. Keep it in
the dev shells, where they're wanted. The package derivation is then the
same as on master.

Changelog-None
The libstdc++ that wheels such as grpcio need is a Linux problem. On
darwin, stdenv.cc.cc is clang, so the hook put clang's lib directory on
the library path for no reason. The shellHook already refers to
stdenv.cc.cc.lib, which pulls it into the shell, so it doesn't need to
be in buildInputs as well.

Changelog-None
On NixOS, uv can't run the Python it downloads, because that binary
expects an FHS dynamic loader:

    error: Python interpreter not found at `~/.local/share/uv/python/cpython-3.13.7-.../bin/python3.13`

Point uv at nixpkgs' Python and stop it from downloading one. This
also keeps the Python, glibc and the libstdc++ on LD_LIBRARY_PATH from
the same nixpkgs.

Changelog-None
@nepet

nepet commented Oct 28, 2026

Copy link
Copy Markdown
Member

Hi @ekzyis, thanks for this, and sorry it sat without a review for so long. To get it in, I've pushed four small commits on top of yours. Your two commits are unchanged. Shout if you disagree with any of it.

  • fa62a54 nix: drop protobuf again. Since 608f695, cln-grpc's build script uses the statically linked protoc from protoc-bin-vendored. The Could not find protoc error can't happen any more, and nothing else calls protoc.
  • 341af7f nix: move openssl from the package to the dev shells. Only the fuzz targets include OpenSSL headers, and make compiles them only when openssl version reports 3 or later. With openssl in the package's buildInputs, its binary is also on PATH during nix build, so the package would have started compiling the fuzz targets too. It's now in the default and postgres dev shells, and the package derivation is the same as on master.
  • 2c484fc nix: only set LD_LIBRARY_PATH in the dev shell on Linux. On darwin, stdenv.cc.cc is clang, so the hook put clang's lib directory on the library path. I also took stdenv.cc.cc.lib out of buildInputs: the shellHook refers to it, which already pulls it into the shell.
  • 2a113db nix: make uv use nixpkgs' Python in the dev shell on Linux. On NixOS, uv can't run the Python it downloads, because that binary expects an FHS dynamic loader: Python interpreter not found at `~/.local/share/uv/python/cpython-3.13.7-…/bin/python3.13` . The shell now sets UV_PYTHON to nixpkgs' Python and UV_PYTHON_DOWNLOADS=never. That also keeps Python, glibc and the libstdc++ on LD_LIBRARY_PATH from the same nixpkgs.

Against master, the PR now only changes nix/shells.nix.

Tested with the branch merged into master (dba2823):

  • aarch64-linux (nixos/nix container, which has no FHS loader either): in nix develop, ./configure && make builds, fuzz targets included. uv run python -c 'import grpc, grpc_tools.protoc, pyln.testing' works, and cargo build -p cln-grpc succeeds with no protoc in the shell.
  • aarch64-darwin, together with Review/nix devshell #9456: ./configure && make builds (with Rust and the fuzz targets), and uv run pytest contrib/pyln-client/tests passes.

On a Mac with Homebrew, the dev shell still needs #9456: without it, configure fails with We need a libsodium >= 1.0.4, as it does on master. So I'd merge this first and rebase #9456 on it.

@Andezion Andezion left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

maybe we could use one shared let block for the openssl, uv and shellHook settings, and reuse it in default and postgres, instead of repeating buildInputs per shell?

@cdecker cdecker 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.

Very nice, can't wait to see more nixified things, as it simplifies things considerably. Seeing that we may in future rely on all tooling being present and working as expected, would allow us for example to stop committing derived files, which are often a headache due to the potential for conflicts and stale files, not to speak of the depressing feeling of opening a 100+ files changed PR :-)

@nepet
nepet merged commit 6b42a83 into ElementsProject:master Oct 28, 2026
85 of 87 checks passed
@nepet nepet mentioned this pull request Oct 28, 2026
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.

4 participants