migrate nim_chat_poc to nbs

This commit is contained in:
Jazz Turner-Baggs 2025-09-26 11:22:45 -07:00
parent a307bf225d
commit 5be16419a1
No known key found for this signature in database
9 changed files with 88 additions and 7 deletions

20
.gitmodules vendored
View File

@ -6,3 +6,23 @@
url = https://github.com/waku-org/nwaku.git
ignore = untracked
branch = master
[submodule "vendor/nim-sds"]
path = vendor/nim-sds
url = https://github.com/jazzz/nim-sds.git
ignore = untracked
branch = master
[submodule "vendor/nim-protobuf-serialization"]
path = vendor/nim-protobuf-serialization
url = https://github.com/status-im/nim-protobuf-serialization.git
ignore = untracked
branch = master
[submodule "vendor/npeg"]
path = vendor/npeg
url = https://github.com/zevv/npeg.git
ignore = untracked
branch = master
[submodule "vendor/blake2"]
path = vendor/blake2
url = https://github.com/narimiran/blake2.git
ignore = untracked
branch = master

View File

@ -1,6 +1,7 @@
export BUILD_SYSTEM_DIR := vendor/nimbus-build-system
export EXCLUDED_NIM_PACKAGES := vendor/nwaku/vendor/nim-dnsdisc/vendor \
vendor/nwaku/vendor/nimbus-build-system
vendor/nwaku/vendor/nimbus-build-system \
vendor/nim-sds/vendor
LINK_PCRE := 0
FORMAT_MSG := "\\x1B[95mFormatting:\\x1B[39m"
# we don't want an error here, so we can handle things later, in the ".DEFAULT" target
@ -27,7 +28,7 @@ else # "variables.mk" was included. Business as usual until the end of this file
.PHONY: all update clean
# default target, because it's the first one that doesn't start with '.'
all: | waku_example
all: | waku_example nim_chat_poc
test_file := $(word 2,$(MAKECMDGOALS))
define test_name
@ -81,6 +82,12 @@ waku_example: | build-waku-librln build-waku-nat nim_chat_poc.nims
\
$(ENV_SCRIPT) nim waku_example $(NIM_PARAMS) nim_chat_poc.nims
nim_chat_poc: | build-waku-librln build-waku-nat nim_chat_poc.nims
echo -e $(BUILD_MSG) "build/$@" && \
\
$(ENV_SCRIPT) nim nim_chat_poc $(NIM_PARAMS) nim_chat_poc.nims
endif

View File

@ -2,12 +2,12 @@ import chronos
import chronicles
import strformat
import chat_sdk/client
import chat_sdk/conversations
import chat_sdk/delivery/waku_client
import chat_sdk/utils
import ../src/chat_sdk/client
import ../src/chat_sdk/conversations
import ../src/chat_sdk/delivery/waku_client
import ../src/chat_sdk/utils
import content_types/all
import ../src/content_types/all
const SELF_DEFINED = 99

46
namble.sh Executable file
View File

@ -0,0 +1,46 @@
#!/bin/bash
# This script provides a 'nimble install' like interface for the nimbus build system.
#
# Usage:
# ./namble.sd <nimble_pkg>
#
#
# The script
# - accesses https://nimble.directory/
# - extracts the <author>/<pkg> from the project directory
# - invokes add_submodule.
# Check if a pkg argument was provided
if [ -z "$1" ]; then
echo "Usage: $0 <pkg>"
exit 1
fi
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ADD_SCRIPT="$SCRIPT_DIR/vendor/nimbus-build-system/scripts/add_submodule.sh"
echo "$ADD_SCRIPT"
echo "Fetching nimble package $1"
URL="https://nimble.directory/pkg/$1"
auth_pkg=$(curl -s "$URL" \
| grep -o '<p> <a href="https://github.com/[^"]*"' \
| sed -E 's#.*github.com/([^"]*)".*#\1#'
)
if [ -z "$auth_pkg" ]; then
echo "No nimble package was found with name <$1>"
exit 1
fi
echo Found "<$auth_pkg>"
$ADD_SCRIPT $auth_pkg
make update

View File

@ -37,3 +37,7 @@ proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") =
task waku_example, "Build Waku based simple example":
let name = "waku_example"
buildBinary name, "examples/", " -d:chronicles_log_level='TRACE' "
task nim_chat_poc, "Build Waku based simple example":
let name = "nim_chat_poc"
buildBinary name, "examples/", " -d:chronicles_log_level='TRACE' "

1
vendor/blake2 vendored Submodule

@ -0,0 +1 @@
Subproject commit 625267e5cb14c87e1d36d79ee24c2f4fe66edfdb

1
vendor/nim-protobuf-serialization vendored Submodule

@ -0,0 +1 @@
Subproject commit 4d74e157cdf1bdcd0ffd41519ebde740c4b80447

1
vendor/nim-sds vendored Submodule

@ -0,0 +1 @@
Subproject commit 6a05cfd2c954886ebbe46adb222ecc1dc9117fd0

1
vendor/npeg vendored Submodule

@ -0,0 +1 @@
Subproject commit 409f6796d0e880b3f0222c964d1da7de6e450811