logos-delivery/flake.nix

130 lines
4.3 KiB
Nix
Raw Normal View History

{
description = "logos-delivery nim build flake";
nixConfig = {
extra-substituters = [ "https://nix-cache.status.im/" ];
extra-trusted-public-keys = [
"nix-cache.status.im-1:x/93lOfLU+duPplwMSBR+OlY4+mo+dCN7n0mr4oPwgY="
];
};
inputs = {
# Pinning the commit to use same commit across different projects.
# A commit from nixpkgs 25.11 release: https://github.com/NixOS/nixpkgs/tree/release-25.11
# Includes the fetchCargoVendor crates.io CDN fix (nixpkgs 0fb82de3).
nixpkgs.url = "github:NixOS/nixpkgs?rev=535f3e6942cb1cead3929c604320d3db54b542b9";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
# Zerokit v2.0.2; keep rev in sync with the vendor/zerokit submodule.
zerokit = {
url = "github:vacp2p/zerokit/5e64cb8822bee65eed6cf459f95ae72b80c6ba63";
inputs.nixpkgs.follows = "nixpkgs";
};
feat(mix,rln-gifter): LEZ-backed RLN mix + 2-phase gifter protocol (rebased onto PR #3807; plugin via nimble) Ports commit 14562878 onto PR #3807's logos_delivery/ layout. Changes vs original 14562878: - Plugin consumed via nimble dep (no submodule add); the PR #3807 nimble resolution already provides it. - mountMix signature carries both PR #3807's disableSpamProtection AND the patch's useOnchainLEZ parameters (callsite passes both). - WakuMix.new branches on disableSpamProtection while also setting useOnchainLEZ on the spam-protection config. Cover-traffic params come from the plugin config when RLN is enabled, fall back to waku defaults when disabled. - start() retains HEAD's split between local-only init and the separate registerDoSProtectionWithNetwork retry loop. publishGossipsubTrigger is promoted to a standalone proc instead of inline in an else branch. - MixProtocol.init uses libp2p_mix's new Opt-wrapped coverTraffic and the MixRlnSpamProtection.new constructor (not the renamed newMixRlnSpamProtection). - Makefile reverted to HEAD: PR #3807 dropped the separate mix-librln archive in favor of a single stateless zerokit, so the patch's MIX_LIBRLN_* additions are obsolete. - README/sim helper config files: HEAD's values retained (env-specific paths from patch author dropped). Adds: - logos_delivery/waku/waku_mix/logos_core_client.nim (RLN client layer) - logos_delivery/waku/waku_mix/coordination handler (via waku_node) - logos_delivery/waku/waku_rln_relay/rln_gifter/{client,protocol,rpc,rpc_codec}.nim - 5 new C FFI exports (logosdelivery_set_rln_fetcher, _set_rln_config, _set_rln_identity, _push_roots, _push_proof) - --mix-gifter-* CLI flags + MixConf fields + MixConfBuilder methods - tests/waku_rln_relay/test_rln_gifter.nim
2026-06-15 13:49:57 -06:00
# Mix RLN spam protection requires a separate, newer zerokit (v2.0.0).
# Pinned by tag to match what scripts/build_rln_mix.sh uses by default.
zerokitMix = {
url = "git+https://github.com/vacp2p/zerokit?ref=refs/tags/v2.0.0";
inputs.nixpkgs.follows = "nixpkgs";
};
};
feat(mix,rln-gifter): LEZ-backed RLN mix + 2-phase gifter protocol (rebased onto PR #3807; plugin via nimble) Ports commit 14562878 onto PR #3807's logos_delivery/ layout. Changes vs original 14562878: - Plugin consumed via nimble dep (no submodule add); the PR #3807 nimble resolution already provides it. - mountMix signature carries both PR #3807's disableSpamProtection AND the patch's useOnchainLEZ parameters (callsite passes both). - WakuMix.new branches on disableSpamProtection while also setting useOnchainLEZ on the spam-protection config. Cover-traffic params come from the plugin config when RLN is enabled, fall back to waku defaults when disabled. - start() retains HEAD's split between local-only init and the separate registerDoSProtectionWithNetwork retry loop. publishGossipsubTrigger is promoted to a standalone proc instead of inline in an else branch. - MixProtocol.init uses libp2p_mix's new Opt-wrapped coverTraffic and the MixRlnSpamProtection.new constructor (not the renamed newMixRlnSpamProtection). - Makefile reverted to HEAD: PR #3807 dropped the separate mix-librln archive in favor of a single stateless zerokit, so the patch's MIX_LIBRLN_* additions are obsolete. - README/sim helper config files: HEAD's values retained (env-specific paths from patch author dropped). Adds: - logos_delivery/waku/waku_mix/logos_core_client.nim (RLN client layer) - logos_delivery/waku/waku_mix/coordination handler (via waku_node) - logos_delivery/waku/waku_rln_relay/rln_gifter/{client,protocol,rpc,rpc_codec}.nim - 5 new C FFI exports (logosdelivery_set_rln_fetcher, _set_rln_config, _set_rln_identity, _push_roots, _push_proof) - --mix-gifter-* CLI flags + MixConf fields + MixConfBuilder methods - tests/waku_rln_relay/test_rln_gifter.nim
2026-06-15 13:49:57 -06:00
outputs = { self, nixpkgs, rust-overlay, zerokit, zerokitMix }:
let
systems = [
"x86_64-linux" "aarch64-linux"
"x86_64-darwin" "aarch64-darwin"
"x86_64-windows"
];
forAllSystems = nixpkgs.lib.genAttrs systems;
fix: real getNodeInfo Version in Nix/lgpm builds (#3889) * fix(node-info): real Version + new Commit in Nix/lgpm builds getNodeInfo Version returned "n/a" on Nix-built libs (and lgpm releases built from the flake) because nix/default.nix never passed -d:git_version. A flake sandbox has no .git, so git describe is impossible; derive the semver from waku.nimble's version field plus the flake short commit, and expose the full commit SHA via a new Commit node info id. - waku_state_info: add Commit to NodeInfoId + dispatch git_commit - waku_node: add git_commit {.strdefine.} (default "n/a") - node start logs ("Starting Waku node" / "Running nwaku node") now print commit = git_commit alongside version - Makefile: inject -d:git_commit (full SHA), mirrors docker label - nix/default.nix: accept gitVersion/gitCommit, pass as nim defines - flake.nix: gitVersion = <nimble version>-g<shortRev>, gitCommit = rev - CI version-check (PR only): ancestor-aware `git describe --tags --abbrev=0` vs PR HEAD, base-version compare, so waku.nimble is kept current early and a new tag never breaks in-flight PRs - release-assets.yml: gate build/upload on a verify-version job asserting tag base == waku.nimble (RC tags allowed), so a mismatched tag publishes no artifacts - docs: prepare_release.md explains the bump-before-tag requirement Refs: status-im/infra-logos#4 Closes: logos-messaging/logos-delivery#3884 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs: simplify * chore: update version in waku.nimble * fix(node-info): remove Commit node info field Drop the newly added Commit (full SHA) node info id and its git_commit compile-time define plumbing across Makefile, flake.nix and nix/default.nix; revert the start/run log lines to version only. The PR now solely fixes the getNodeInfo Version regression. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(nix): align git_version format closer to Makefile Adds the `v` prefix and uses a 6-char SHA so Nix-built nodes report e.g. `v0.38.1-g52e980`, matching the shape of `git describe --abbrev=6 --always --tags` aside from the unreachable commit-count segment (tag metadata isn't exposed through the flake input protocol). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 21:57:14 +01:00
lib = nixpkgs.lib;
# Single source of truth for the semver: the `version` field of
# logos_delivery.nimble. Kept in sync with git tags by the version-check CI.
fix: real getNodeInfo Version in Nix/lgpm builds (#3889) * fix(node-info): real Version + new Commit in Nix/lgpm builds getNodeInfo Version returned "n/a" on Nix-built libs (and lgpm releases built from the flake) because nix/default.nix never passed -d:git_version. A flake sandbox has no .git, so git describe is impossible; derive the semver from waku.nimble's version field plus the flake short commit, and expose the full commit SHA via a new Commit node info id. - waku_state_info: add Commit to NodeInfoId + dispatch git_commit - waku_node: add git_commit {.strdefine.} (default "n/a") - node start logs ("Starting Waku node" / "Running nwaku node") now print commit = git_commit alongside version - Makefile: inject -d:git_commit (full SHA), mirrors docker label - nix/default.nix: accept gitVersion/gitCommit, pass as nim defines - flake.nix: gitVersion = <nimble version>-g<shortRev>, gitCommit = rev - CI version-check (PR only): ancestor-aware `git describe --tags --abbrev=0` vs PR HEAD, base-version compare, so waku.nimble is kept current early and a new tag never breaks in-flight PRs - release-assets.yml: gate build/upload on a verify-version job asserting tag base == waku.nimble (RC tags allowed), so a mismatched tag publishes no artifacts - docs: prepare_release.md explains the bump-before-tag requirement Refs: status-im/infra-logos#4 Closes: logos-messaging/logos-delivery#3884 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs: simplify * chore: update version in waku.nimble * fix(node-info): remove Commit node info field Drop the newly added Commit (full SHA) node info id and its git_commit compile-time define plumbing across Makefile, flake.nix and nix/default.nix; revert the start/run log lines to version only. The PR now solely fixes the getNodeInfo Version regression. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(nix): align git_version format closer to Makefile Adds the `v` prefix and uses a 6-char SHA so Nix-built nodes report e.g. `v0.38.1-g52e980`, matching the shape of `git describe --abbrev=6 --always --tags` aside from the unreachable commit-count segment (tag metadata isn't exposed through the flake input protocol). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 21:57:14 +01:00
nimbleVersion =
let line = lib.findFirst (l: lib.hasPrefix "version = " l)
"version = \"unknown\""
(lib.splitString "\n" (builtins.readFile ./logos_delivery.nimble));
fix: real getNodeInfo Version in Nix/lgpm builds (#3889) * fix(node-info): real Version + new Commit in Nix/lgpm builds getNodeInfo Version returned "n/a" on Nix-built libs (and lgpm releases built from the flake) because nix/default.nix never passed -d:git_version. A flake sandbox has no .git, so git describe is impossible; derive the semver from waku.nimble's version field plus the flake short commit, and expose the full commit SHA via a new Commit node info id. - waku_state_info: add Commit to NodeInfoId + dispatch git_commit - waku_node: add git_commit {.strdefine.} (default "n/a") - node start logs ("Starting Waku node" / "Running nwaku node") now print commit = git_commit alongside version - Makefile: inject -d:git_commit (full SHA), mirrors docker label - nix/default.nix: accept gitVersion/gitCommit, pass as nim defines - flake.nix: gitVersion = <nimble version>-g<shortRev>, gitCommit = rev - CI version-check (PR only): ancestor-aware `git describe --tags --abbrev=0` vs PR HEAD, base-version compare, so waku.nimble is kept current early and a new tag never breaks in-flight PRs - release-assets.yml: gate build/upload on a verify-version job asserting tag base == waku.nimble (RC tags allowed), so a mismatched tag publishes no artifacts - docs: prepare_release.md explains the bump-before-tag requirement Refs: status-im/infra-logos#4 Closes: logos-messaging/logos-delivery#3884 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs: simplify * chore: update version in waku.nimble * fix(node-info): remove Commit node info field Drop the newly added Commit (full SHA) node info id and its git_commit compile-time define plumbing across Makefile, flake.nix and nix/default.nix; revert the start/run log lines to version only. The PR now solely fixes the getNodeInfo Version regression. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(nix): align git_version format closer to Makefile Adds the `v` prefix and uses a 6-char SHA so Nix-built nodes report e.g. `v0.38.1-g52e980`, matching the shape of `git describe --abbrev=6 --always --tags` aside from the unreachable commit-count segment (tag metadata isn't exposed through the flake input protocol). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 21:57:14 +01:00
in lib.removeSuffix "\"" (lib.removePrefix "version = \"" line);
# A flake sandbox has no .git, so `git describe` is impossible; the
# commit comes from the flake metadata instead.
shortRev = self.shortRev or self.dirtyShortRev or "dirty";
nimbleOverlay = final: prev: {
nimble = prev.nimble.overrideAttrs (_: {
version = "0.22.3";
src = prev.fetchFromGitHub {
owner = "nim-lang";
repo = "nimble";
rev = "v0.22.3";
sha256 = "sha256-f7DYpRGVUeSi6basK1lfu5AxZpMFOSJ3oYsy+urYErg=";
};
});
};
pkgsFor = system: import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) nimbleOverlay ];
};
in {
packages = forAllSystems (system:
let
pkgs = pkgsFor system;
feat(mix,rln-gifter): LEZ-backed RLN mix + 2-phase gifter protocol (rebased onto PR #3807; plugin via nimble) Ports commit 14562878 onto PR #3807's logos_delivery/ layout. Changes vs original 14562878: - Plugin consumed via nimble dep (no submodule add); the PR #3807 nimble resolution already provides it. - mountMix signature carries both PR #3807's disableSpamProtection AND the patch's useOnchainLEZ parameters (callsite passes both). - WakuMix.new branches on disableSpamProtection while also setting useOnchainLEZ on the spam-protection config. Cover-traffic params come from the plugin config when RLN is enabled, fall back to waku defaults when disabled. - start() retains HEAD's split between local-only init and the separate registerDoSProtectionWithNetwork retry loop. publishGossipsubTrigger is promoted to a standalone proc instead of inline in an else branch. - MixProtocol.init uses libp2p_mix's new Opt-wrapped coverTraffic and the MixRlnSpamProtection.new constructor (not the renamed newMixRlnSpamProtection). - Makefile reverted to HEAD: PR #3807 dropped the separate mix-librln archive in favor of a single stateless zerokit, so the patch's MIX_LIBRLN_* additions are obsolete. - README/sim helper config files: HEAD's values retained (env-specific paths from patch author dropped). Adds: - logos_delivery/waku/waku_mix/logos_core_client.nim (RLN client layer) - logos_delivery/waku/waku_mix/coordination handler (via waku_node) - logos_delivery/waku/waku_rln_relay/rln_gifter/{client,protocol,rpc,rpc_codec}.nim - 5 new C FFI exports (logosdelivery_set_rln_fetcher, _set_rln_config, _set_rln_identity, _push_roots, _push_proof) - --mix-gifter-* CLI flags + MixConf fields + MixConfBuilder methods - tests/waku_rln_relay/test_rln_gifter.nim
2026-06-15 13:49:57 -06:00
zerokitRln = import ./nix/zerokit.nix {
inherit zerokit system;
vendorHash = "sha256-PNwEdZLgGQPqQDrEK2hsQtSybVfBbD6xn4K47fPFJUU=";
};
zerokitMixRln = import ./nix/zerokit.nix {
zerokit = zerokitMix;
inherit system;
vendorHash = "sha256-SoMl0QBBgTG1b4UhOlErlzWmg3J6G0xOC0tNDddOptA=";
};
2026-04-27 12:51:39 +02:00
liblogosdelivery = pkgs.callPackage ./nix/default.nix {
inherit pkgs;
src = ./.;
feat(mix,rln-gifter): LEZ-backed RLN mix + 2-phase gifter protocol (rebased onto PR #3807; plugin via nimble) Ports commit 14562878 onto PR #3807's logos_delivery/ layout. Changes vs original 14562878: - Plugin consumed via nimble dep (no submodule add); the PR #3807 nimble resolution already provides it. - mountMix signature carries both PR #3807's disableSpamProtection AND the patch's useOnchainLEZ parameters (callsite passes both). - WakuMix.new branches on disableSpamProtection while also setting useOnchainLEZ on the spam-protection config. Cover-traffic params come from the plugin config when RLN is enabled, fall back to waku defaults when disabled. - start() retains HEAD's split between local-only init and the separate registerDoSProtectionWithNetwork retry loop. publishGossipsubTrigger is promoted to a standalone proc instead of inline in an else branch. - MixProtocol.init uses libp2p_mix's new Opt-wrapped coverTraffic and the MixRlnSpamProtection.new constructor (not the renamed newMixRlnSpamProtection). - Makefile reverted to HEAD: PR #3807 dropped the separate mix-librln archive in favor of a single stateless zerokit, so the patch's MIX_LIBRLN_* additions are obsolete. - README/sim helper config files: HEAD's values retained (env-specific paths from patch author dropped). Adds: - logos_delivery/waku/waku_mix/logos_core_client.nim (RLN client layer) - logos_delivery/waku/waku_mix/coordination handler (via waku_node) - logos_delivery/waku/waku_rln_relay/rln_gifter/{client,protocol,rpc,rpc_codec}.nim - 5 new C FFI exports (logosdelivery_set_rln_fetcher, _set_rln_config, _set_rln_identity, _push_roots, _push_proof) - --mix-gifter-* CLI flags + MixConf fields + MixConfBuilder methods - tests/waku_rln_relay/test_rln_gifter.nim
2026-06-15 13:49:57 -06:00
inherit zerokitRln zerokitMixRln;
fix: real getNodeInfo Version in Nix/lgpm builds (#3889) * fix(node-info): real Version + new Commit in Nix/lgpm builds getNodeInfo Version returned "n/a" on Nix-built libs (and lgpm releases built from the flake) because nix/default.nix never passed -d:git_version. A flake sandbox has no .git, so git describe is impossible; derive the semver from waku.nimble's version field plus the flake short commit, and expose the full commit SHA via a new Commit node info id. - waku_state_info: add Commit to NodeInfoId + dispatch git_commit - waku_node: add git_commit {.strdefine.} (default "n/a") - node start logs ("Starting Waku node" / "Running nwaku node") now print commit = git_commit alongside version - Makefile: inject -d:git_commit (full SHA), mirrors docker label - nix/default.nix: accept gitVersion/gitCommit, pass as nim defines - flake.nix: gitVersion = <nimble version>-g<shortRev>, gitCommit = rev - CI version-check (PR only): ancestor-aware `git describe --tags --abbrev=0` vs PR HEAD, base-version compare, so waku.nimble is kept current early and a new tag never breaks in-flight PRs - release-assets.yml: gate build/upload on a verify-version job asserting tag base == waku.nimble (RC tags allowed), so a mismatched tag publishes no artifacts - docs: prepare_release.md explains the bump-before-tag requirement Refs: status-im/infra-logos#4 Closes: logos-messaging/logos-delivery#3884 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs: simplify * chore: update version in waku.nimble * fix(node-info): remove Commit node info field Drop the newly added Commit (full SHA) node info id and its git_commit compile-time define plumbing across Makefile, flake.nix and nix/default.nix; revert the start/run log lines to version only. The PR now solely fixes the getNodeInfo Version regression. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(nix): align git_version format closer to Makefile Adds the `v` prefix and uses a 6-char SHA so Nix-built nodes report e.g. `v0.38.1-g52e980`, matching the shape of `git describe --abbrev=6 --always --tags` aside from the unreachable commit-count segment (tag metadata isn't exposed through the flake input protocol). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 21:57:14 +01:00
gitVersion = "v${nimbleVersion}-g${builtins.substring 0 6 shortRev}";
feat(mix,rln-gifter): LEZ-backed RLN mix + 2-phase gifter protocol (rebased onto PR #3807; plugin via nimble) Ports commit 14562878 onto PR #3807's logos_delivery/ layout. Changes vs original 14562878: - Plugin consumed via nimble dep (no submodule add); the PR #3807 nimble resolution already provides it. - mountMix signature carries both PR #3807's disableSpamProtection AND the patch's useOnchainLEZ parameters (callsite passes both). - WakuMix.new branches on disableSpamProtection while also setting useOnchainLEZ on the spam-protection config. Cover-traffic params come from the plugin config when RLN is enabled, fall back to waku defaults when disabled. - start() retains HEAD's split between local-only init and the separate registerDoSProtectionWithNetwork retry loop. publishGossipsubTrigger is promoted to a standalone proc instead of inline in an else branch. - MixProtocol.init uses libp2p_mix's new Opt-wrapped coverTraffic and the MixRlnSpamProtection.new constructor (not the renamed newMixRlnSpamProtection). - Makefile reverted to HEAD: PR #3807 dropped the separate mix-librln archive in favor of a single stateless zerokit, so the patch's MIX_LIBRLN_* additions are obsolete. - README/sim helper config files: HEAD's values retained (env-specific paths from patch author dropped). Adds: - logos_delivery/waku/waku_mix/logos_core_client.nim (RLN client layer) - logos_delivery/waku/waku_mix/coordination handler (via waku_node) - logos_delivery/waku/waku_rln_relay/rln_gifter/{client,protocol,rpc,rpc_codec}.nim - 5 new C FFI exports (logosdelivery_set_rln_fetcher, _set_rln_config, _set_rln_identity, _push_roots, _push_proof) - --mix-gifter-* CLI flags + MixConf fields + MixConfBuilder methods - tests/waku_rln_relay/test_rln_gifter.nim
2026-06-15 13:49:57 -06:00
# The .lgx wrapper does not put its variant dir on dyld's search
# path, so nim's runtime dlopen("libpq.dylib") from db_postgres
# fails even though libpq.dylib ships in the bundle. Disable
# postgres so the dylib has no runtime libpq dependency.
enablePostgres = false;
};
wakucanary = pkgs.callPackage ./nix/default.nix {
inherit pkgs;
src = ./.;
targets = ["wakucanary"];
inherit zerokitRln;
};
2026-04-27 12:51:39 +02:00
in {
inherit liblogosdelivery wakucanary;
# Expose librln so downstream consumers link the exact same build.
rln = zerokitRln;
2026-04-27 12:51:39 +02:00
default = liblogosdelivery;
}
);
devShells = forAllSystems (system:
let
pkgs = pkgsFor system;
in {
default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
nim-2_2
nimble
];
};
}
);
};
}