deep refactor

This commit is contained in:
Ivan Folgueira Bande 2026-02-15 23:50:41 +01:00
parent 20f6322939
commit 05f75f7078
No known key found for this signature in database
GPG Key ID: 3C117481F89E24A7
8 changed files with 512 additions and 490 deletions

View File

@ -369,27 +369,30 @@ docker-liteprotocoltester-push:
.PHONY: cbindings cwaku_example libwaku
STATIC ?= 0
BUILD_COMMAND ?= libwakuDynamic
detected_OS ?= Linux
ifeq ($(OS),Windows_NT)
detected_OS := Windows
else
detected_OS := $(shell uname -s)
endif
BUILD_COMMAND ?= libsdsDynamic
ifeq ($(STATIC), 1)
BUILD_COMMAND = libsdsStatic
endif
ifeq ($(detected_OS),Windows)
LIB_EXT_DYNAMIC = dll
LIB_EXT_STATIC = lib
BUILD_COMMAND := $(BUILD_COMMAND)Windows
else ifeq ($(detected_OS),Darwin)
LIB_EXT_DYNAMIC = dylib
LIB_EXT_STATIC = a
BUILD_COMMAND := $(BUILD_COMMAND)Mac
export IOS_SDK_PATH := $(shell xcrun --sdk iphoneos --show-sdk-path)
else ifeq ($(detected_OS),Linux)
LIB_EXT_DYNAMIC = so
LIB_EXT_STATIC = a
BUILD_COMMAND := $(BUILD_COMMAND)Linux
endif
LIB_EXT := $(LIB_EXT_DYNAMIC)
ifeq ($(STATIC), 1)
LIB_EXT = $(LIB_EXT_STATIC)
BUILD_COMMAND = libwakuStatic
endif
libwaku: | build librln
nimble --verbose $(BUILD_COMMAND) waku.nimble $@.$(LIB_EXT)
libwaku: |
nimble --verbose $(BUILD_COMMAND) $(NIM_PARAMS) --noNimblePath waku.nimble
cwaku_example: | build libwaku
echo -e $(BUILD_MSG) "build/$@" && \

View File

@ -118,8 +118,3 @@ if defined(android):
switch("passC", "--sysroot=" & sysRoot)
switch("passL", "--sysroot=" & sysRoot)
switch("cincludes", sysRoot & "/usr/include/")
# begin Nimble config (version 2)
--noNimblePath
when withDir(thisDir(), system.fileExists("nimble.paths")):
include "nimble.paths"
# end Nimble config

51
flake.lock generated
View File

@ -2,27 +2,48 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1757590060,
"narHash": "sha256-EWwwdKLMZALkgHFyKW7rmyhxECO74+N+ZO5xTDnY/5c=",
"lastModified": 1740603184,
"narHash": "sha256-t+VaahjQAWyA+Ctn2idyo1yxRIYpaDxMgHkgCNiMJa4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0ef228213045d2cdb5a169a95d63ded38670b293",
"rev": "f44bd8ca21e026135061a0a57dcf3d0775b67a49",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0ef228213045d2cdb5a169a95d63ded38670b293",
"rev": "f44bd8ca21e026135061a0a57dcf3d0775b67a49",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay",
"zerokit": "zerokit"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1771125043,
"narHash": "sha256-ldf/s49n6rOAxl7pYLJGGS1N/assoHkCOWdEdLyNZkc=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "4912f951a26dc8142b176be2c2ad834319dc06e8",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"rust-overlay_2": {
"inputs": {
"nixpkgs": [
"zerokit",
@ -48,21 +69,21 @@
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": "rust-overlay"
"rust-overlay": "rust-overlay_2"
},
"locked": {
"lastModified": 1762211504,
"narHash": "sha256-SbDoBElFYJ4cYebltxlO2lYnz6qOaDAVY6aNJ5bqHDE=",
"ref": "refs/heads/master",
"rev": "3160d9504d07791f2fc9b610948a6cf9a58ed488",
"revCount": 342,
"type": "git",
"url": "https://github.com/vacp2p/zerokit"
"lastModified": 1759236302,
"narHash": "sha256-tzX/C5tKo5GkydZPFhGafRdFqgHUqTpr2sh/49/a/sY=",
"owner": "vacp2p",
"repo": "zerokit",
"rev": "a4bb3feb5054e6fd24827adf204493e6e173437b",
"type": "github"
},
"original": {
"rev": "3160d9504d07791f2fc9b610948a6cf9a58ed488",
"type": "git",
"url": "https://github.com/vacp2p/zerokit"
"owner": "vacp2p",
"ref": "v0.9.0",
"repo": "zerokit",
"type": "github"
}
}
},

View File

@ -7,17 +7,22 @@
};
inputs = {
# We are pinning the commit because ultimately we want to use same commit across different projects.
# A commit from nixpkgs 24.11 release : https://github.com/NixOS/nixpkgs/tree/release-24.11
nixpkgs.url = "github:NixOS/nixpkgs/0ef228213045d2cdb5a169a95d63ded38670b293";
# WARNING: Remember to update commit and use 'nix flake update' to update flake.lock.
# Pinned nixpkgs commit
nixpkgs.url = "github:NixOS/nixpkgs?rev=f44bd8ca21e026135061a0a57dcf3d0775b67a49";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
# External flake input: Zerokit pinned to a specific commit
zerokit = {
url = "git+https://github.com/vacp2p/zerokit?rev=3160d9504d07791f2fc9b610948a6cf9a58ed488";
url = "github:vacp2p/zerokit/v0.9.0";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, zerokit }:
outputs = { self, nixpkgs, rust-overlay, zerokit }:
let
stableSystems = [
"x86_64-linux" "aarch64-linux"
@ -35,7 +40,8 @@
android_sdk.accept_license = true;
allowUnfree = true;
};
overlays = [
overlays = [
rust-overlay.overlays.default
(final: prev: {
androidEnvCustom = prev.callPackage ./nix/pkgs/android-sdk { };
androidPkgs = final.androidEnvCustom.pkgs;
@ -46,33 +52,37 @@
);
in rec {
packages = forAllSystems (system: let
pkgs = pkgsFor.${system};
in rec {
libwaku-android-arm64 = pkgs.callPackage ./nix/default.nix {
inherit stableSystems;
src = self;
targets = ["libwaku-android-arm64"];
abidir = "arm64-v8a";
zerokitRln = zerokit.packages.${system}.rln-android-arm64;
};
packages = forAllSystems (system:
let pkgs = pkgsFor.${system};
libwaku = pkgs.callPackage ./nix/default.nix {
inherit stableSystems;
src = self;
targets = ["libwaku"];
zerokitRln = zerokit.packages.${system}.rln;
};
in rec {
# Consumer packages (src = self)
libwaku-android-arm64 = pkgs.callPackage ./nix/default.nix {
inherit stableSystems;
src = self;
targets = ["libwaku-android-arm64"];
abidir = "arm64-v8a";
zerokitRln = zerokit.packages.${system}.rln-android-arm64;
};
wakucanary = pkgs.callPackage ./nix/default.nix {
inherit stableSystems;
src = self;
targets = ["wakucanary"];
zerokitRln = zerokit.packages.${system}.rln;
};
libwaku = pkgs.callPackage ./nix/default.nix {
inherit stableSystems;
src = self;
targets = ["libwaku"];
zerokitRln = zerokit.packages.${system}.rln;
};
default = libwaku;
});
wakucanary = pkgs.callPackage ./nix/default.nix {
inherit stableSystems;
src = self;
targets = ["wakucanary"];
zerokitRln = zerokit.packages.${system}.rln;
};
# Default package for convenience
default = libwaku;
}
);
devShells = forAllSystems (system: {
default = pkgsFor.${system}.callPackage ./nix/shell.nix {};

View File

@ -1,36 +1,12 @@
{
"version": 2,
"packages": {
"nim": {
"version": "2.2.6",
"vcsRevision": "372826d4317f1f8cb99abd750698f4a00c5cd39a",
"url": "https://github.com/nim-lang/Nim.git",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "b3179cffd77e51d16ea343b5493d895e8bc8c085"
}
},
"libbacktrace": {
"version": "0.0.9",
"vcsRevision": "d8bd4ce5c46bb6d2f984f6b3f3d7380897d95ecb",
"url": "https://github.com/status-im/nim-libbacktrace",
"downloadMethod": "git",
"dependencies": [
"nim"
],
"checksums": {
"sha1": "ae3e8ecc27d80fd02b4538c7bdc9edf470d5023e"
}
},
"unittest2": {
"version": "0.2.5",
"vcsRevision": "26f2ef3ae0ec72a2a75bfe557e02e88f6a31c189",
"url": "https://github.com/status-im/nim-unittest2",
"downloadMethod": "git",
"dependencies": [
"nim"
],
"dependencies": [],
"checksums": {
"sha1": "02bb3751ba9ddc3c17bfd89f2e41cb6bfb8fc0c9"
}
@ -41,7 +17,6 @@
"url": "https://github.com/status-im/nim-bearssl",
"downloadMethod": "git",
"dependencies": [
"nim",
"unittest2"
],
"checksums": {
@ -49,89 +24,33 @@
}
},
"bearssl_pkey_decoder": {
"version": "#21dd3710df9345ed2ad8bf8f882761e07863b8e0",
"version": "0.1.0",
"vcsRevision": "21dd3710df9345ed2ad8bf8f882761e07863b8e0",
"url": "https://github.com/vacp2p/bearssl_pkey_decoder",
"downloadMethod": "git",
"dependencies": [
"nim",
"bearssl"
],
"checksums": {
"sha1": "21b42e2e6ddca6c875d3fc50f36a5115abf51714"
}
},
"jwt": {
"version": "#18f8378de52b241f321c1f9ea905456e89b95c6f",
"vcsRevision": "18f8378de52b241f321c1f9ea905456e89b95c6f",
"url": "https://github.com/vacp2p/nim-jwt.git",
"downloadMethod": "git",
"dependencies": [
"nim",
"bearssl",
"bearssl_pkey_decoder"
],
"checksums": {
"sha1": "bcfd6fc9c5e10a52b87117219b7ab5c98136bc8e"
}
},
"testutils": {
"version": "0.8.0",
"vcsRevision": "e4d37dc1652d5c63afb89907efb5a5e812261797",
"url": "https://github.com/status-im/nim-testutils",
"downloadMethod": "git",
"dependencies": [
"nim",
"unittest2"
],
"checksums": {
"sha1": "d1678f50aa47d113b4e77d41eec2190830b523fa"
}
},
"db_connector": {
"version": "0.1.0",
"vcsRevision": "29450a2063970712422e1ab857695c12d80112a6",
"url": "https://github.com/nim-lang/db_connector",
"downloadMethod": "git",
"dependencies": [
"nim"
],
"checksums": {
"sha1": "4f2e67d0e4b61af9ac5575509305660b473f01a4"
}
},
"results": {
"version": "0.5.1",
"vcsRevision": "df8113dda4c2d74d460a8fa98252b0b771bf1f27",
"url": "https://github.com/arnetheduck/nim-results",
"downloadMethod": "git",
"dependencies": [
"nim"
],
"dependencies": [],
"checksums": {
"sha1": "a9c011f74bc9ed5c91103917b9f382b12e82a9e7"
}
},
"nat_traversal": {
"version": "0.0.1",
"vcsRevision": "860e18c37667b5dd005b94c63264560c35d88004",
"url": "https://github.com/status-im/nim-nat-traversal",
"downloadMethod": "git",
"dependencies": [
"nim",
"results"
],
"checksums": {
"sha1": "1a376d3e710590ef2c48748a546369755f0a7c97"
}
},
"stew": {
"version": "0.4.2",
"vcsRevision": "b66168735d6f3841c5239c3169d3fe5fe98b1257",
"url": "https://github.com/status-im/nim-stew",
"downloadMethod": "git",
"dependencies": [
"nim",
"results",
"unittest2"
],
@ -139,74 +58,12 @@
"sha1": "928e82cb8d2f554e8f10feb2349ee9c32fee3a8c"
}
},
"zlib": {
"version": "0.1.0",
"vcsRevision": "e680f269fb01af2c34a2ba879ff281795a5258fe",
"url": "https://github.com/status-im/nim-zlib",
"downloadMethod": "git",
"dependencies": [
"nim",
"stew",
"results"
],
"checksums": {
"sha1": "bbde4f5a97a84b450fef7d107461e5f35cf2b47f"
}
},
"httputils": {
"version": "0.4.0",
"vcsRevision": "c53852d9e24205b6363bba517fa8ee7bde823691",
"url": "https://github.com/status-im/nim-http-utils",
"downloadMethod": "git",
"dependencies": [
"nim",
"stew",
"results",
"unittest2"
],
"checksums": {
"sha1": "298bc5b6fe4e5aa9c3b7e2ebfa17191675020f10"
}
},
"chronos": {
"version": "4.2.0",
"vcsRevision": "0d00279e67ad9fadeb944944449adc89f052b8bd",
"url": "https://github.com/status-im/nim-chronos",
"downloadMethod": "git",
"dependencies": [
"nim",
"results",
"stew",
"bearssl",
"httputils",
"unittest2"
],
"checksums": {
"sha1": "add14e711abc98b2203e7c5a35c860c7b86f15b5"
}
},
"metrics": {
"version": "0.1.2",
"vcsRevision": "11d0cddfb0e711aa2a8c75d1892ae24a64c299fc",
"url": "https://github.com/status-im/nim-metrics",
"downloadMethod": "git",
"dependencies": [
"nim",
"chronos",
"results",
"stew"
],
"checksums": {
"sha1": "5cdac99d85d3c146d170e85064c88fb28f377842"
}
},
"faststreams": {
"version": "0.5.0",
"vcsRevision": "ce27581a3e881f782f482cb66dc5b07a02bd615e",
"url": "https://github.com/status-im/nim-faststreams",
"downloadMethod": "git",
"dependencies": [
"nim",
"stew",
"unittest2"
],
@ -214,29 +71,12 @@
"sha1": "ee61e507b805ae1df7ec936f03f2d101b0d72383"
}
},
"snappy": {
"version": "0.1.0",
"vcsRevision": "00bfcef94f8ef6981df5d5b994897f6695badfb2",
"url": "https://github.com/status-im/nim-snappy",
"downloadMethod": "git",
"dependencies": [
"nim",
"faststreams",
"unittest2",
"results",
"stew"
],
"checksums": {
"sha1": "e572d60d6a3178c5b1cde2400c51ad771812cd3d"
}
},
"serialization": {
"version": "0.5.2",
"vcsRevision": "b0f2fa32960ea532a184394b0f27be37bd80248b",
"url": "https://github.com/status-im/nim-serialization",
"downloadMethod": "git",
"dependencies": [
"nim",
"faststreams",
"unittest2",
"stew"
@ -245,43 +85,12 @@
"sha1": "fa35c1bb76a0a02a2379fe86eaae0957c7527cb8"
}
},
"toml_serialization": {
"version": "0.2.18",
"vcsRevision": "b5b387e6fb2a7cc75d54a269b07cc6218361bd46",
"url": "https://github.com/status-im/nim-toml-serialization",
"downloadMethod": "git",
"dependencies": [
"nim",
"faststreams",
"serialization",
"stew"
],
"checksums": {
"sha1": "76ae1c2af5dd092849b41750ff29217980dc9ca3"
}
},
"confutils": {
"version": "0.1.0",
"vcsRevision": "f684e55d56ba4016e2add64f74c4840476aa493d",
"url": "https://github.com/status-im/nim-confutils",
"downloadMethod": "git",
"dependencies": [
"nim",
"stew",
"serialization",
"results"
],
"checksums": {
"sha1": "1bef15b34686adf71e88883cfc2452afe9fa095f"
}
},
"json_serialization": {
"version": "0.4.4",
"vcsRevision": "c343b0e243d9e17e2c40f3a8a24340f7c4a71d44",
"url": "https://github.com/status-im/nim-json-serialization",
"downloadMethod": "git",
"dependencies": [
"nim",
"faststreams",
"serialization",
"stew",
@ -291,13 +100,24 @@
"sha1": "8b3115354104858a0ac9019356fb29720529c2bd"
}
},
"testutils": {
"version": "0.8.0",
"vcsRevision": "e4d37dc1652d5c63afb89907efb5a5e812261797",
"url": "https://github.com/status-im/nim-testutils",
"downloadMethod": "git",
"dependencies": [
"unittest2"
],
"checksums": {
"sha1": "d1678f50aa47d113b4e77d41eec2190830b523fa"
}
},
"chronicles": {
"version": "0.12.2",
"vcsRevision": "27ec507429a4eb81edc20f28292ee8ec420be05b",
"url": "https://github.com/status-im/nim-chronicles",
"downloadMethod": "git",
"dependencies": [
"nim",
"faststreams",
"serialization",
"json_serialization",
@ -307,21 +127,78 @@
"sha1": "02febb20d088120b2836d3306cfa21f434f88f65"
}
},
"presto": {
"version": "0.1.1",
"vcsRevision": "d66043dd7ede146442e6c39720c76a20bde5225f",
"url": "https://github.com/status-im/nim-presto",
"httputils": {
"version": "0.4.0",
"vcsRevision": "c53852d9e24205b6363bba517fa8ee7bde823691",
"url": "https://github.com/status-im/nim-http-utils",
"downloadMethod": "git",
"dependencies": [
"nim",
"chronos",
"chronicles",
"metrics",
"stew",
"results",
"stew"
"unittest2"
],
"checksums": {
"sha1": "8df97c45683abe2337bdff43b844c4fbcc124ca2"
"sha1": "298bc5b6fe4e5aa9c3b7e2ebfa17191675020f10"
}
},
"chronos": {
"version": "4.0.4",
"vcsRevision": "0646c444fce7c7ed08ef6f2c9a7abfd172ffe655",
"url": "https://github.com/status-im/nim-chronos",
"downloadMethod": "git",
"dependencies": [
"results",
"stew",
"bearssl",
"httputils",
"unittest2"
],
"checksums": {
"sha1": "455802a90204d8ad6b31d53f2efff8ebfe4c834a"
}
},
"confutils": {
"version": "0.1.0",
"vcsRevision": "f684e55d56ba4016e2add64f74c4840476aa493d",
"url": "https://github.com/status-im/nim-confutils",
"downloadMethod": "git",
"dependencies": [
"stew",
"serialization",
"results"
],
"checksums": {
"sha1": "1bef15b34686adf71e88883cfc2452afe9fa095f"
}
},
"db_connector": {
"version": "0.1.0",
"vcsRevision": "29450a2063970712422e1ab857695c12d80112a6",
"url": "https://github.com/nim-lang/db_connector",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "4f2e67d0e4b61af9ac5575509305660b473f01a4"
}
},
"dnsclient": {
"version": "0.3.4",
"vcsRevision": "23214235d4784d24aceed99bbfe153379ea557c8",
"url": "https://github.com/ba0f3/dnsclient.nim",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "65262c7e533ff49d6aca5539da4bc6c6ce132f40"
}
},
"nimcrypto": {
"version": "0.7.3",
"vcsRevision": "b3dbc9c4d08e58c5b7bfad6dc7ef2ee52f2f4c08",
"url": "https://github.com/cheatfate/nimcrypto",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "f72b90fe3f4da09efa482de4f8729e7ee4abea2f"
}
},
"stint": {
@ -330,7 +207,6 @@
"url": "https://github.com/status-im/nim-stint",
"downloadMethod": "git",
"dependencies": [
"nim",
"stew",
"unittest2"
],
@ -338,148 +214,12 @@
"sha1": "d8f871fd617e7857192d4609fe003b48942a8ae5"
}
},
"minilru": {
"version": "0.1.0",
"vcsRevision": "6dd93feb60f4cded3c05e7af7209cf63fb677893",
"url": "https://github.com/status-im/nim-minilru",
"downloadMethod": "git",
"dependencies": [
"nim",
"results",
"unittest2"
],
"checksums": {
"sha1": "0be03a5da29fdd4409ea74a60fd0ccce882601b4"
}
},
"sqlite3_abi": {
"version": "3.51.2.0",
"vcsRevision": "89ba51f557414d3a3e17ab3df8270e1bdaa3ca2a",
"url": "https://github.com/arnetheduck/nim-sqlite3-abi",
"downloadMethod": "git",
"dependencies": [
"nim"
],
"checksums": {
"sha1": "921e733e4e8ebadc7fd06660716be8821df384ba"
}
},
"dnsclient": {
"version": "0.3.4",
"vcsRevision": "23214235d4784d24aceed99bbfe153379ea557c8",
"url": "https://github.com/ba0f3/dnsclient.nim",
"downloadMethod": "git",
"dependencies": [
"nim"
],
"checksums": {
"sha1": "65262c7e533ff49d6aca5539da4bc6c6ce132f40"
}
},
"unicodedb": {
"version": "0.13.2",
"vcsRevision": "66f2458710dc641dd4640368f9483c8a0ec70561",
"url": "https://github.com/nitely/nim-unicodedb",
"downloadMethod": "git",
"dependencies": [
"nim"
],
"checksums": {
"sha1": "739102d885d99bb4571b1955f5f12aee423c935b"
}
},
"regex": {
"version": "0.26.3",
"vcsRevision": "4593305ed1e49731fc75af1dc572dd2559aad19c",
"url": "https://github.com/nitely/nim-regex",
"downloadMethod": "git",
"dependencies": [
"nim",
"unicodedb"
],
"checksums": {
"sha1": "4d24e7d7441137cd202e16f2359a5807ddbdc31f"
}
},
"nimcrypto": {
"version": "0.7.3",
"vcsRevision": "b3dbc9c4d08e58c5b7bfad6dc7ef2ee52f2f4c08",
"url": "https://github.com/cheatfate/nimcrypto",
"downloadMethod": "git",
"dependencies": [
"nim"
],
"checksums": {
"sha1": "f72b90fe3f4da09efa482de4f8729e7ee4abea2f"
}
},
"websock": {
"version": "#allow-high-chronos-versions",
"vcsRevision": "21a7c1982d1524081f29f7fcfab0850b80708db5",
"url": "https://github.com/status-im/nim-websock.git",
"downloadMethod": "git",
"dependencies": [
"nim",
"chronos",
"httputils",
"chronicles",
"stew",
"nimcrypto",
"bearssl",
"results",
"zlib"
],
"checksums": {
"sha1": "50744c55ca69a01332d38825a478e3cb13935b60"
}
},
"json_rpc": {
"version": "0.5.4",
"vcsRevision": "b6e40a776fa2d00b97a9366761fb7da18f31ae5c",
"url": "https://github.com/status-im/nim-json-rpc",
"downloadMethod": "git",
"dependencies": [
"nim",
"stew",
"nimcrypto",
"stint",
"chronos",
"httputils",
"chronicles",
"websock",
"serialization",
"json_serialization",
"unittest2"
],
"checksums": {
"sha1": "d8e8be795fcf098f4ce03b5826f6b3153f6a6e07"
}
},
"lsquic": {
"version": "#4fb03ee7bfb39aecb3316889fdcb60bec3d0936f",
"vcsRevision": "4fb03ee7bfb39aecb3316889fdcb60bec3d0936f",
"url": "https://github.com/vacp2p/nim-lsquic",
"downloadMethod": "git",
"dependencies": [
"nim",
"zlib",
"stew",
"chronos",
"nimcrypto",
"unittest2",
"chronicles"
],
"checksums": {
"sha1": "f465fa994346490d0924d162f53d9b5aec62f948"
}
},
"secp256k1": {
"version": "0.6.0.3.2",
"vcsRevision": "d8f1288b7c72f00be5fc2c5ea72bf5cae1eafb15",
"url": "https://github.com/status-im/nim-secp256k1",
"downloadMethod": "git",
"dependencies": [
"nim",
"stew",
"results",
"nimcrypto"
@ -488,13 +228,76 @@
"sha1": "6618ef9de17121846a8c1d0317026b0ce8584e10"
}
},
"nat_traversal": {
"version": "0.0.1",
"vcsRevision": "860e18c37667b5dd005b94c63264560c35d88004",
"url": "https://github.com/status-im/nim-nat-traversal",
"downloadMethod": "git",
"dependencies": [
"results"
],
"checksums": {
"sha1": "1a376d3e710590ef2c48748a546369755f0a7c97"
}
},
"metrics": {
"version": "0.1.2",
"vcsRevision": "11d0cddfb0e711aa2a8c75d1892ae24a64c299fc",
"url": "https://github.com/status-im/nim-metrics",
"downloadMethod": "git",
"dependencies": [
"chronos",
"results",
"stew"
],
"checksums": {
"sha1": "5cdac99d85d3c146d170e85064c88fb28f377842"
}
},
"sqlite3_abi": {
"version": "3.51.2.0",
"vcsRevision": "89ba51f557414d3a3e17ab3df8270e1bdaa3ca2a",
"url": "https://github.com/arnetheduck/nim-sqlite3-abi",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "921e733e4e8ebadc7fd06660716be8821df384ba"
}
},
"minilru": {
"version": "0.1.0",
"vcsRevision": "6dd93feb60f4cded3c05e7af7209cf63fb677893",
"url": "https://github.com/status-im/nim-minilru",
"downloadMethod": "git",
"dependencies": [
"results",
"unittest2"
],
"checksums": {
"sha1": "0be03a5da29fdd4409ea74a60fd0ccce882601b4"
}
},
"snappy": {
"version": "0.1.0",
"vcsRevision": "00bfcef94f8ef6981df5d5b994897f6695badfb2",
"url": "https://github.com/status-im/nim-snappy",
"downloadMethod": "git",
"dependencies": [
"faststreams",
"unittest2",
"results",
"stew"
],
"checksums": {
"sha1": "e572d60d6a3178c5b1cde2400c51ad771812cd3d"
}
},
"eth": {
"version": "0.9.0",
"vcsRevision": "d9135e6c3c5d6d819afdfb566aa8d958756b73a8",
"url": "https://github.com/status-im/nim-eth",
"downloadMethod": "git",
"dependencies": [
"nim",
"nimcrypto",
"stint",
"secp256k1",
@ -515,37 +318,12 @@
"sha1": "2e01b0cfff9523d110562af70d19948280f8013e"
}
},
"web3": {
"version": "0.8.0",
"vcsRevision": "cdfe5601d2812a58e54faf53ee634452d01e5918",
"url": "https://github.com/status-im/nim-web3",
"downloadMethod": "git",
"dependencies": [
"nim",
"chronicles",
"chronos",
"bearssl",
"eth",
"faststreams",
"json_rpc",
"serialization",
"json_serialization",
"nimcrypto",
"stew",
"stint",
"results"
],
"checksums": {
"sha1": "26a112af032ef1536f97da2ca7364af618a11b80"
}
},
"dnsdisc": {
"version": "0.1.0",
"vcsRevision": "203abd2b3e758e0ea3ae325769b20a7e1bcd1010",
"url": "https://github.com/status-im/nim-dnsdisc",
"downloadMethod": "git",
"dependencies": [
"nim",
"bearssl",
"chronicles",
"chronos",
@ -561,13 +339,119 @@
"sha1": "c8aeb7a29b378d9ed5201c8f0273000b46552e26"
}
},
"taskpools": {
"version": "0.1.0",
"vcsRevision": "9e8ccc754631ac55ac2fd495e167e74e86293edb",
"url": "https://github.com/status-im/nim-taskpools",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "09e1b2fdad55b973724d61227971afc0df0b7a81"
}
},
"ffi": {
"version": "0.1.3",
"vcsRevision": "06111de155253b34e47ed2aaed1d61d08d62cc1b",
"url": "https://github.com/logos-messaging/nim-ffi",
"downloadMethod": "git",
"dependencies": [
"chronos",
"chronicles",
"taskpools"
],
"checksums": {
"sha1": "6f9d49375ea1dc71add55c72ac80a808f238e5b0"
}
},
"zlib": {
"version": "0.1.0",
"vcsRevision": "e680f269fb01af2c34a2ba879ff281795a5258fe",
"url": "https://github.com/status-im/nim-zlib",
"downloadMethod": "git",
"dependencies": [
"stew",
"results"
],
"checksums": {
"sha1": "bbde4f5a97a84b450fef7d107461e5f35cf2b47f"
}
},
"websock": {
"version": "0.2.1",
"vcsRevision": "35ae76f1559e835c80f9c1a3943bf995d3dd9eb5",
"url": "https://github.com/status-im/nim-websock",
"downloadMethod": "git",
"dependencies": [
"chronos",
"httputils",
"chronicles",
"stew",
"nimcrypto",
"bearssl",
"results",
"zlib"
],
"checksums": {
"sha1": "1cb5efa10cd389bc01d0707c242ae010c76a03cd"
}
},
"json_rpc": {
"version": "0.5.4",
"vcsRevision": "b6e40a776fa2d00b97a9366761fb7da18f31ae5c",
"url": "https://github.com/status-im/nim-json-rpc",
"downloadMethod": "git",
"dependencies": [
"stew",
"nimcrypto",
"stint",
"chronos",
"httputils",
"chronicles",
"websock",
"serialization",
"json_serialization",
"unittest2"
],
"checksums": {
"sha1": "d8e8be795fcf098f4ce03b5826f6b3153f6a6e07"
}
},
"jwt": {
"version": "0.2",
"vcsRevision": "18f8378de52b241f321c1f9ea905456e89b95c6f",
"url": "https://github.com/vacp2p/nim-jwt.git",
"downloadMethod": "git",
"dependencies": [
"bearssl",
"bearssl_pkey_decoder"
],
"checksums": {
"sha1": "bcfd6fc9c5e10a52b87117219b7ab5c98136bc8e"
}
},
"lsquic": {
"version": "0.0.1",
"vcsRevision": "4fb03ee7bfb39aecb3316889fdcb60bec3d0936f",
"url": "https://github.com/vacp2p/nim-lsquic",
"downloadMethod": "git",
"dependencies": [
"zlib",
"stew",
"chronos",
"nimcrypto",
"unittest2",
"chronicles"
],
"checksums": {
"sha1": "f465fa994346490d0924d162f53d9b5aec62f948"
}
},
"libp2p": {
"version": "1.15.2",
"vcsRevision": "ca48c3718246bb411ff0e354a70cb82d9a28de0d",
"url": "https://github.com/vacp2p/nim-libp2p",
"downloadMethod": "git",
"dependencies": [
"nim",
"nimcrypto",
"dnsclient",
"bearssl",
@ -586,31 +470,79 @@
"sha1": "3b2cdc7e00261eb4210ca3d44ec3bd64c2b7bbba"
}
},
"taskpools": {
"version": "0.1.0",
"vcsRevision": "9e8ccc754631ac55ac2fd495e167e74e86293edb",
"url": "https://github.com/status-im/nim-taskpools",
"presto": {
"version": "0.1.1",
"vcsRevision": "d66043dd7ede146442e6c39720c76a20bde5225f",
"url": "https://github.com/status-im/nim-presto",
"downloadMethod": "git",
"dependencies": [
"nim"
],
"checksums": {
"sha1": "09e1b2fdad55b973724d61227971afc0df0b7a81"
}
},
"ffi": {
"version": "0.1.3",
"vcsRevision": "06111de155253b34e47ed2aaed1d61d08d62cc1b",
"url": "https://github.com/logos-messaging/nim-ffi",
"downloadMethod": "git",
"dependencies": [
"nim",
"chronos",
"chronicles",
"taskpools"
"metrics",
"results",
"stew"
],
"checksums": {
"sha1": "6f9d49375ea1dc71add55c72ac80a808f238e5b0"
"sha1": "8df97c45683abe2337bdff43b844c4fbcc124ca2"
}
},
"unicodedb": {
"version": "0.13.2",
"vcsRevision": "66f2458710dc641dd4640368f9483c8a0ec70561",
"url": "https://github.com/nitely/nim-unicodedb",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "739102d885d99bb4571b1955f5f12aee423c935b"
}
},
"regex": {
"version": "0.26.3",
"vcsRevision": "4593305ed1e49731fc75af1dc572dd2559aad19c",
"url": "https://github.com/nitely/nim-regex",
"downloadMethod": "git",
"dependencies": [
"unicodedb"
],
"checksums": {
"sha1": "4d24e7d7441137cd202e16f2359a5807ddbdc31f"
}
},
"toml_serialization": {
"version": "0.2.18",
"vcsRevision": "b5b387e6fb2a7cc75d54a269b07cc6218361bd46",
"url": "https://github.com/status-im/nim-toml-serialization",
"downloadMethod": "git",
"dependencies": [
"faststreams",
"serialization",
"stew"
],
"checksums": {
"sha1": "76ae1c2af5dd092849b41750ff29217980dc9ca3"
}
},
"web3": {
"version": "0.8.0",
"vcsRevision": "cdfe5601d2812a58e54faf53ee634452d01e5918",
"url": "https://github.com/status-im/nim-web3",
"downloadMethod": "git",
"dependencies": [
"chronicles",
"chronos",
"bearssl",
"eth",
"faststreams",
"json_rpc",
"serialization",
"json_serialization",
"nimcrypto",
"stew",
"stint",
"results"
],
"checksums": {
"sha1": "26a112af032ef1536f97da2ca7364af618a11b80"
}
}
},

View File

@ -24,18 +24,19 @@ let
};
in stdenv.mkDerivation {
pname = "logos-message-delivery";
pname = "logos-delivery";
inherit src;
version = "${version}-${revision}";
env = {
ANDROID_SDK_ROOT="${pkgs.androidPkgs.sdk}";
ANDROID_NDK_HOME="${pkgs.androidPkgs.ndk}";
#ANDROID_SDK_ROOT="${pkgs.androidPkgs.sdk}";
#ANDROID_NDK_HOME="${pkgs.androidPkgs.ndk}";
NIMFLAGS = "-d:disableMarchNative -d:git_revision_override=${revision}";
};
buildInputs = with pkgs; [
openssl gmp zip bash nim nimble cacert
git cmake cargo-make rustup
];
# Dependencies that should only exist in the build environment.
@ -54,9 +55,7 @@ in stdenv.mkDerivation {
];
configurePhase = ''
export HOME=$TMPDIR
export XDG_CACHE_HOME=$TMPDIR
export NIMBLE_DIR=$NIX_BUILD_TOP/nimbledeps
cp -r ${nimbleDeps}/nimbledeps $NIMBLE_DIR
cp ${nimbleDeps}/nimble.paths ./
chmod 775 -R $NIMBLE_DIR
@ -64,10 +63,6 @@ in stdenv.mkDerivation {
sed -i "s|./nimbledeps|$NIMBLE_DIR|g" nimble.paths
'';
buildPhase = ''
nimble --verbose --offline libwakuDynamic --noRefresh --noNimblePath waku.nimble libwaku.so
'';
installPhase = if abidir != null then ''
mkdir -p $out/jni
cp -r ./build/android/${abidir}/* $out/jni/

View File

@ -1,9 +1,4 @@
{ pkgs
, stdenv
, src
, version
, revision
}:
{ pkgs, stdenv, src, version, revision }:
stdenv.mkDerivation {
pname = "logos-delivery-nimble-deps";
@ -12,8 +7,8 @@ stdenv.mkDerivation {
inherit src;
nativeBuildInputs = with pkgs; [
jq rsync git cacert moreutils
] ++ [ nimble ];
jq rsync git nim nimble cacert moreutils which
];
configurePhase = ''
export XDG_CACHE_HOME=$TMPDIR
@ -23,8 +18,8 @@ stdenv.mkDerivation {
buildPhase = ''
nimble --version
nimble --localdeps setup
nimble --localdeps install
nimble --verbose --localdeps setup
nimble --silent --localdeps install -y --depsOnly
'';
installPhase = ''
@ -58,7 +53,7 @@ stdenv.mkDerivation {
'';
# Make this a fixed-output derivation to allow internet access for Nimble.
outputHash = "sha256-5NZ0RPK8ssxNdyuBbFNljct5hjnIM1FrHzWwL8ujuqY=";
outputHash = "sha256-+INiCNg51bT4p7oL8+Hr+1pVJu5GDz8L1zAOyjS/Y8o=";
outputHashAlgo = "sha256";
outputHashMode = "recursive";
}

View File

@ -8,10 +8,9 @@ version = "0.36.0"
author = "Status Research & Development GmbH"
description = "Waku, Private P2P Messaging for Resource-Restricted Devices"
license = "MIT or Apache License 2.0"
srcDir = "waku"
### Dependencies
requires "nim >= 2.2.4",
requires "nim >= 2.2.0",
# Async & Concurrency
"chronos >= 4.0.4",
"taskpools",
@ -52,7 +51,6 @@ requires "nim >= 2.2.4",
"minilru",
"zlib",
# Debug & Testing
"libbacktrace",
"testutils",
"unittest2"
@ -93,22 +91,95 @@ proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") =
exec "nim " & lang & " --out:build/" & name & " --mm:refc " & extra_params & " " &
srcDir & name & ".nim"
proc buildLibrary(lib_name: string, srcDir = "./", params = "", `type` = "static") =
proc buildLibrary(outLibNameAndExt: string,
name: string,
srcDir = "./",
extra_params = "",
`type` = "static") =
if not dirExists "build":
mkDir "build"
# Get extra params from NIM_PARAMS environment variable
var extra_params = params
let nimParams = getEnv("NIM_PARAMS")
if nimParams.len > 0:
extra_params &= " " & nimParams
if `type` == "static":
exec "nim c" & " --out:build/" & lib_name &
" --threads:on --app:staticlib --opt:size --noMain --mm:refc --header -d:metrics --nimMainPrefix:libwaku --skipParentCfg:on -d:discv5_protocol_id=d5waku " &
extra_params & " " & srcDir & "libwaku.nim"
exec "nim c" & " --out:build/" & outLibNameAndExt &
" --threads:on --app:staticlib --opt:size --noMain --mm:refc --header -d:metrics" &
" --nimMainPrefix:libwaku -d:discv5_protocol_id=d5waku " &
extra_params & " " & srcDir & name & ".nim"
else:
exec "nim c" & " --out:build/" & lib_name &
" --threads:on --app:lib --opt:size --noMain --mm:refc --header -d:metrics --nimMainPrefix:libwaku --skipParentCfg:off -d:discv5_protocol_id=d5waku " &
extra_params & " " & srcDir & "libwaku.nim"
when defined(windows):
exec "nim c" & " --out:build/" & outLibNameAndExt &
" --threads:on --app:lib --opt:size --noMain --mm:refc --header -d:metrics" &
" --nimMainPrefix:libwaku -d:discv5_protocol_id=d5waku " &
extra_params & " " & srcDir & name & ".nim"
else:
exec "nim c" & " --out:build/" & outLibNameAndExt &
" --threads:on --app:lib --opt:size --noMain --mm:refc --header -d:metrics" &
" --nimMainPrefix:libwaku -d:discv5_protocol_id=d5waku " &
extra_params & " " & srcDir & name & ".nim"
proc getArch(): string =
let arch = getEnv("ARCH")
if arch != "": return $arch
let (archFromUname, _) = gorgeEx("uname -m")
return $archFromUname
task libsdsDynamicWindows, "Generate bindings":
let outLibNameAndExt = "libwaku.dll"
let name = "libwaku"
buildLibrary outLibNameAndExt,
name, "library/",
"""-d:chronicles_line_numbers --warning:Deprecated:off --warning:UnusedImport:on -d:chronicles_log_level=TRACE """,
"dynamic"
task libsdsDynamicLinux, "Generate bindings":
let outLibNameAndExt = "libwaku.so"
let name = "libwaku"
buildLibrary outLibNameAndExt,
name, "library/",
"""-d:chronicles_line_numbers --warning:Deprecated:off --warning:UnusedImport:on -d:chronicles_log_level=TRACE """,
"dynamic"
task libsdsDynamicMac, "Generate bindings":
let outLibNameAndExt = "libwaku.dylib"
let name = "libwaku"
let arch = getArch()
let sdkPath = staticExec("xcrun --show-sdk-path").strip()
let archFlags = (if arch == "arm64": "--cpu:arm64 --passC:\"-arch arm64\" --passL:\"-arch arm64\" --passC:\"-isysroot " & sdkPath & "\" --passL:\"-isysroot " & sdkPath & "\""
else: "--cpu:amd64 --passC:\"-arch x86_64\" --passL:\"-arch x86_64\" --passC:\"-isysroot " & sdkPath & "\" --passL:\"-isysroot " & sdkPath & "\"")
buildLibrary outLibNameAndExt,
name, "library/",
archFlags & " -d:chronicles_line_numbers --warning:Deprecated:off --warning:UnusedImport:on -d:chronicles_log_level=TRACE",
"dynamic"
task libsdsStaticWindows, "Generate bindings":
let outLibNameAndExt = "libwaku.lib"
let name = "libwaku"
buildLibrary outLibNameAndExt,
name, "library/",
"""-d:chronicles_line_numbers --warning:Deprecated:off --warning:UnusedImport:on -d:chronicles_log_level=TRACE """,
"static"
task libsdsStaticLinux, "Generate bindings":
let outLibNameAndExt = "libwaku.a"
let name = "libwaku"
buildLibrary outLibNameAndExt,
name, "library/",
"""-d:chronicles_line_numbers --warning:Deprecated:off --warning:UnusedImport:on -d:chronicles_log_level=TRACE """,
"static"
task libsdsStaticMac, "Generate bindings":
let outLibNameAndExt = "libwaku.a"
let name = "libwaku"
let arch = getArch()
let sdkPath = staticExec("xcrun --show-sdk-path").strip()
let archFlags = (if arch == "arm64": "--cpu:arm64 --passC:\"-arch arm64\" --passL:\"-arch arm64\" --passC:\"-isysroot " & sdkPath & "\" --passL:\"-isysroot " & sdkPath & "\""
else: "--cpu:amd64 --passC:\"-arch x86_64\" --passL:\"-arch x86_64\" --passC:\"-isysroot " & sdkPath & "\" --passL:\"-isysroot " & sdkPath & "\"")
buildLibrary outLibNameAndExt,
name, "library/",
archFlags & " -d:chronicles_line_numbers --warning:Deprecated:off --warning:UnusedImport:on -d:chronicles_log_level=TRACE",
"static"
proc buildMobileAndroid(srcDir = ".", params = "") =
let cpu = getEnv("CPU")