osmaczko 5034086fef
Chore/make nix build phase configurable (#3826)
* nix: parameterize build flags with named args

Expose `enablePostgres`, `enableNimDebugDlOpen`, and `chroniclesLogLevel`
as arguments on `nix/default.nix`. Defaults preserve today's hardcoded
behavior, so `nix build .#liblogosdelivery` with no overrides is a
no-op change.

Consume the package via `callPackage` in `flake.nix` so consumers can
use `.override { ... }` without extra wrapping.

* nix: link libstdc++ on Linux so consumers don't need patchelf

Append `stdenv.cc.cc.lib` to `buildInputs` on Linux and add `-lstdc++`
to the Nim `--passL` flags. Nix stdenv's fixupPhase will auto-inject
`${stdenv.cc.cc.lib}/lib` into the output's RUNPATH, so downstream
consumers can drop their patchelf step.

macOS resolves the C++ stdlib via dyld/libc++ and is unaffected.

* nix: bundle librln into the output for a self-contained package

Copy the librln shared library (`librln.so` / `librln.dylib`) from the
zerokit input into `$out/lib` and rewrite the internal reference in
`liblogosdelivery`:

- Darwin: set librln's install name to `@rpath/librln.dylib`, change the
  consumer's reference to match, and add `@loader_path` as an rpath.
- Linux: add `$ORIGIN` to the rpath so `librln.so` resolves from the
  sibling directory, preserving the gcc-lib entry injected by the stdenv
  fixupPhase for libstdc++.

The installed `liblogosdelivery` no longer carries a `/nix/store/...`
absolute path to zerokit, so downstream consumers can ship the bundle
as-is.
2026-04-27 12:51:39 +02:00
..

Usage

Shell

A development shell can be started using:

nix develop

Building

To build a Codex you can use:

nix build '.?submodules=1#default'

The ?submodules=1 part should eventually not be necessary. For more details see: https://github.com/NixOS/nix/issues/4423

It can be also done without even cloning the repo:

nix build 'git+https://github.com/waku-org/nwaku?submodules=1#'

Running

nix run 'git+https://github.com/waku-org/nwaku?submodules=1#''

Testing

nix flake check ".?submodules=1#"