nix: fix nix build and simplify NixOS install docs
Some checks are pending
Continuous Integration / Pre-build checks (push) Waiting to run
Continuous Integration / Build compile-clang-sanitizers (push) Blocked by required conditions
Continuous Integration / Build compile-clang (push) Blocked by required conditions
Continuous Integration / Build compile-gcc (push) Blocked by required conditions
Continuous Integration / Build compile-gcc-O1 (push) Blocked by required conditions
Continuous Integration / Build compile-gcc-O3 (push) Blocked by required conditions
Continuous Integration / check-compiled-source (compile-gcc) (push) Blocked by required conditions
Continuous Integration / Run unit tests (push) Blocked by required conditions
Continuous Integration / Run unit tests-1 (push) Blocked by required conditions
Continuous Integration / Build 32-bit (size_t != 64-bit warnings) (push) Blocked by required conditions
Continuous Integration / Run fuzz regression tests (push) Blocked by required conditions
Continuous Integration / Check we can downgrade the node (push) Blocked by required conditions
Continuous Integration / Check we can downgrade the node-1 (push) Blocked by required conditions
Continuous Integration / Check we can downgrade the node-2 (push) Blocked by required conditions
Continuous Integration / First Integration Tests (1/6) (push) Blocked by required conditions
Continuous Integration / First Integration Tests (2/6) (push) Blocked by required conditions
Continuous Integration / First Integration Tests (3/6) (push) Blocked by required conditions
Continuous Integration / First Integration Tests (4/6) (push) Blocked by required conditions
Continuous Integration / First Integration Tests (5/6) (push) Blocked by required conditions
Continuous Integration / First Integration Tests (6/6) (push) Blocked by required conditions
Continuous Integration / Test CLN dual-fund Full Integration (push) Blocked by required conditions
Continuous Integration / Test CLN liquid Full Integration (push) Blocked by required conditions
Continuous Integration / Test CLN postgres Full Integration (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (1/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (10/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (11/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (12/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (2/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (3/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (4/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (5/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (6/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (7/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (8/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (9/12) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (1/6) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (2/6) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (3/6) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (4/6) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (5/6) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (6/6) (push) Blocked by required conditions
Continuous Integration / Update examples in doc schemas (push) Blocked by required conditions
Continuous Integration / Test minimum supported BTC v25.0 with clang (push) Blocked by required conditions
Continuous Integration / CI completion (push) Blocked by required conditions
Release Rust 🦀 / release_rust (push) Waiting to run
ReadMe Sync / rdme-docs-sync (push) Waiting to run

CLN's ./configure detects Python through `uv` (see default_python in
configure), which the cln derivation does not provide, so PYTHON ends up
empty and the build fails when a Makefile step runs
`$(PYTHON) devtools/blockreplace.py`. Set PYTHON=python3 in preConfigure
(the derivation already ships a python3 with mako/grpcio-tools) and add
blockreplace.py to patchShebangs.

With `nix build` working again, replace the stale poetry-based NixOS section
of the install guide with the flake commands (nix build / nix run /
nix profile install / nix develop). Verified in a nixos/nix container:
nix build ".?submodules=1" produces lightningd/lightning-cli v26.06.1.

Changelog-Fixed: nix: the flake build (`nix build`) no longer fails because ./configure cannot detect Python.
This commit is contained in:
enaples 2026-06-08 17:27:24 +02:00 committed by Christian Decker
parent a87aa28a71
commit 531673a441
2 changed files with 40 additions and 7 deletions

View file

@ -317,13 +317,40 @@ Finally, build `c-lightning`:
## To Build on NixOS
Use nix-shell launch a shell with a full Core Lightning dev environment:
Core Lightning ships a [Nix flake](https://nixos.wiki/wiki/Flakes), so on NixOS
you don't need to install any build dependencies by hand. Make sure the
`nix-command` and `flakes` features are enabled.
Build and run directly from the repository; the git submodules are fetched
automatically and the binaries are placed under `./result/bin`:
```shell
nix-shell -Q -p gdb sqlite autoconf git clang libtool sqlite autoconf \
autogen automake gmp zlib gettext libsodium poetry 'python3.withPackages (p: [p.bitcoinlib])' \
valgrind --run "./configure && poetry shell"
poetry install
make
nix build github:ElementsProject/lightning
# Or run them straight away:
nix run github:ElementsProject/lightning#lightningd -- --version
nix run github:ElementsProject/lightning#lightning-cli -- --version
```
Build a specific release by appending the tag, or install into your profile:
```shell
nix build github:ElementsProject/lightning/v26.06.1
nix profile install github:ElementsProject/lightning
```
From a local checkout, append `?submodules=1` so the build sees the submodules:
```shell
git clone https://github.com/ElementsProject/lightning.git
cd lightning
git checkout v26.06.1
nix build ".?submodules=1"
./result/bin/lightningd --version
```
To build with PostgreSQL support use the `cln-postgres` package, and for a
development shell with the full toolchain use `nix develop`:
```shell
nix build ".?submodules=1#cln-postgres"
nix develop
```
## To Build on macOS Apple Silicon

View file

@ -66,7 +66,8 @@ stdenv.mkDerivation {
tools/update-mocks.sh \
tools/mockup.sh \
tools/fromschema.py \
devtools/sql-rewrite.py
devtools/sql-rewrite.py \
devtools/blockreplace.py
''
else
''
@ -76,6 +77,11 @@ stdenv.mkDerivation {
configureFlags = [ "--disable-valgrind" ];
# ./configure detects Python via `uv` (configure:default_python), which is not
# part of this derivation. Point it at the python3 we already provide so the
# codegen steps that call $(PYTHON) (e.g. devtools/blockreplace.py) work.
preConfigure = "export PYTHON=python3";
enableParallelBuilding = true;
# workaround for build issue, happens only x86_64-darwin, not aarch64-darwin