nix: fix `nix build` and simplify NixOS install docs
What changed, and why it matters
This commit fixes the Nix package build for Core Lightning so that `nix build` works again. It is a build-system/documentation fix, not a security patch. There is no vulnerability being fixed here.
No security action needed. Treat as a normal build-system/documentation fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change updates nix/pkgs/default.nix to set PYTHON=python3 during the preConfigure phase and adds devtools/blockreplace.py to the patchShebangs list. This resolves a build failure where ./configure could not detect Python because the derivation lacks uv, leaving $(PYTHON) empty when Make invoked devtools/blockreplace.py. The accompanying documentation update replaces outdated poetry-based NixOS install instructions with flake-based commands.
Changed components
nix/pkgs/default.nixdoc/getting-started/getting-started/installation.mdInspect captured patch +40 / −7
diff --git a/doc/getting-started/getting-started/installation.md b/doc/getting-started/getting-started/installation.md
index 29e7627e..c7640a55 100644
--- a/doc/getting-started/getting-started/installation.md
+++ b/doc/getting-started/getting-started/installation.md
@@ -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
diff --git a/nix/pkgs/default.nix b/nix/pkgs/default.nix
index fb1663c1..1ac526d5 100644
--- a/nix/pkgs/default.nix
+++ b/nix/pkgs/default.nix
@@ -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
Why this scored 16/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.