nim-chat-poc/flake.nix
Prem Chaitanya Prathi c9dfefa498
feat(mix): mixnet sender-anonymity for Logos Chat (static RLN, no LEZ)
Global, restart-based Required/None anonymity mode: route chat messages through the
libp2p mixnet for sender anonymity, on the logos-delivery (efafdfdc2) nwaku stack.
Static RLN spam protection; no on-chain LEZ gifter / dynamic membership.

Delivery (src/chat/delivery/waku_client.nim):
- WakuConfig.mixEnabled/mixNodes/minMixPoolSize; parseMixNodes, waitForMixPool,
  getMixPoolSize, mixReady.
- Required mode: sendBytes -> lightpushPublish(mixify=true) over the mix pool,
  fail-fast below minMixPoolSize (no relay fallback). None mode: relay publish.
  Errors propagate up to chat_send_message.
- Receive via WakuFilter (subscribe to static peers; no relay mounted), refreshed
  by a 60s keep-alive.
- Static RLN: pre-populated rln_tree.db + per-peer keystore; nodekey config to adopt
  a provisioned identity. No per-send root-convergence wait (static membership).

API / build:
- chat_get_mix_status FFI -> {mixEnabled,mixReady,mixPoolSize,minPoolSize}.
- Reproducible nix build: librln consumed as a cdylib (avoids the two-Rust-staticlib
  symbol collision); -d:libp2p_mix_experimental_exit_is_dest.
- vendor/nwaku -> efafdfdc2; vendor/nim-protobuf-serialization -> 38d24eb (0.4.0).
2026-06-25 21:45:41 +05:30

44 lines
1.5 KiB
Nix

{
description = "logos-chat shared library";
nixConfig = {
extra-substituters = [ "https://nix-cache.status.im/" ];
extra-trusted-public-keys = [ "nix-cache.status.im-1:x/93lOfLU+duPplwMSBR+OlY4+mo+dCN7n0mr4oPwgY=" ];
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, rust-overlay, flake-utils }:
flake-utils.lib.eachSystem [
"x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"
] (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ rust-overlay.overlays.default ];
};
libchatDrv = pkgs.callPackage ./nix/libchat.nix {};
rustBundleDrv = pkgs.callPackage ./nix/rust_bundle.nix { src = self; };
# efafdfdc2's nwaku consumes its nim deps via nimble (nimbledeps/pkgs2),
# which isn't reproducible in the nix sandbox. Instead fetch them from
# vendor/nwaku's autogenerated deps.nix (mirrors logos-delivery's build).
nwakuDeps = import (self + "/vendor/nwaku/nix/deps.nix") { inherit pkgs; };
in {
packages.default = pkgs.callPackage ./nix/default.nix {
src = self;
inherit rustBundleDrv nwakuDeps;
};
devShells.default = pkgs.callPackage ./nix/shell.nix {
inherit libchatDrv;
};
}
);
}