diff --git a/Makefile b/Makefile index 829d55f27..f350a6a4a 100644 --- a/Makefile +++ b/Makefile @@ -84,18 +84,17 @@ build: waku.nims: ln -s waku.nimble $@ -# Update dependencies using Nimble -# This is the ONLY target that should install/update Nimble packages +# Install dependencies from nimble.lock (reproducible builds) +# This installs both the Nim compiler and all package dependencies update: | waku.nims @echo -e $(INFO_MSG) "Updating vendor submodules..." git submodule update --init --recursive - @echo -e $(INFO_MSG) "Installing/updating Nimble dependencies..." - nimble install --depsOnly -y - @echo -e $(INFO_MSG) "Setting up Nimble paths..." - nimble setup - @echo -e $(INFO_MSG) "Building nph formatter..." - $(MAKE) build-nph - @echo -e $(INFO_MSG) "Update complete!" + @echo -e $(INFO_MSG) "Installing Nim compiler and dependencies from nimble.lock..." + nimble setup --accept + @echo -e $(INFO_MSG) "Setup complete!" + +# Main deps target that other targets depend on +deps: update clean: @echo -e $(INFO_MSG) "Cleaning Nimble package cache..." @@ -138,7 +137,7 @@ endif ################## ## Dependencies ## ################## -.PHONY: deps libbacktrace +.PHONY: update deps check-deps libbacktrace FOUNDRY_VERSION := 1.5.0 PNPM_VERSION := 10.23.0 @@ -157,7 +156,7 @@ rln-deps: rustup # Check dependencies are ready (does NOT install packages) # Run 'make update' first to install/update Nimble packages -deps: | waku.nims +check-deps: | waku.nims @echo -e $(INFO_MSG) "Dependencies check passed" @echo -e $(INFO_MSG) "If you haven't run 'make update' yet, please do so to install Nimble packages" @@ -324,32 +323,14 @@ networkmonitor: | build deps librln ############ ## Format ## ############ -.PHONY: build-nph install-nph clean-nph print-nph-path +.PHONY: install-nph-hook -# Default location for nph binary shall be next to nim binary to make it available on the path. -NPH:=$(shell dirname $(NIM_BINARY))/nph - -# nph is installed via Nimble, find it in nimble bin directory -NIMBLE_BIN_DIR := $(shell nimble path 2>/dev/null | head -1 | xargs dirname 2>/dev/null)/../bin -NPH_NIMBLE := $(NIMBLE_BIN_DIR)/nph - -build-nph: | build deps -ifeq ("$(wildcard $(NPH))","") - @echo -e $(INFO_MSG) "Installing nph via Nimble..." - nimble install -y nph - @# copy binary next to Nim compiler if not already there - @if [ ! -f "$(NPH)" ]; then \ - NPH_INSTALLED=$$(command -v nph 2>/dev/null || true); \ - [ -n "$$NPH_INSTALLED" ] && cp "$$NPH_INSTALLED" "$(NPH)"; \ - fi - @echo "nph utility is available at $(NPH)" -else - @echo "nph utility already exists at $(NPH)" -endif +# nph is installed via 'nimble setup' from waku.nimble dependencies +# Just use it directly from ~/.nimble/bin/nph GIT_PRE_COMMIT_HOOK := .git/hooks/pre-commit -install-nph: build-nph +install-nph-hook: ifeq ("$(wildcard $(GIT_PRE_COMMIT_HOOK))","") cp ./scripts/git_pre_commit_format.sh $(GIT_PRE_COMMIT_HOOK) else @@ -357,18 +338,10 @@ else exit 1 endif -nph/%: | build-nph +# Format files using nph from Nimble bin +nph/%: echo -e $(FORMAT_MSG) "nph/$*" && \ - $(NPH) $* - -clean-nph: - rm -f $(NPH) - -# To avoid hardcoding nph binary location in several places -print-nph-path: - echo "$(NPH)" - -clean: | clean-nph + nph $* ################### ## Documentation ## diff --git a/nimble.lock b/nimble.lock index 85fff0f91..b1ef3655a 100644 --- a/nimble.lock +++ b/nimble.lock @@ -538,16 +538,6 @@ "sha1": "3c089f3ccd23aa5a04e5db288cb8eef524938487" } }, - "nim": { - "version": "2.2.6", - "vcsRevision": "", - "url": "https://github.com/nim-lang/Nim.git", - "downloadMethod": "git", - "dependencies": [], - "checksums": { - "sha1": "764c73fdbdb824cd7ec41eb254a3ec20e538c467" - } - }, "toml_serialization": { "version": "0.2.18", "vcsRevision": "b5b387e6fb2a7cc75d54a269b07cc6218361bd46", diff --git a/waku.nimble b/waku.nimble index 9037a714b..68d4f24a9 100644 --- a/waku.nimble +++ b/waku.nimble @@ -42,7 +42,7 @@ requires "nimcrypto" requires "db_connector" requires "dnsclient" requires "nph" -requires "https://github.com/logos-messaging/nim-ffi" +requires "ffi" requires "eth" requires "libp2p" requires "web3" @@ -238,17 +238,11 @@ import std/sequtils # Helper to find Nimble package path proc findNimblePkg(pkgName: string): string = let nimbleDir = getEnv("NIMBLE_DIR", getEnv("HOME") & "/.nimble") - let pkgsDir = nimbleDir & "/pkgs2" + let pkgsDir = nimbleDir & "/pkgs" if dirExists(pkgsDir): for kind, path in walkDir(pkgsDir): if kind == pcDir and path.contains(pkgName): return path - # Fallback to pkgs (older nimble) - let pkgsDirOld = nimbleDir & "/pkgs" - if dirExists(pkgsDirOld): - for kind, path in walkDir(pkgsDirOld): - if kind == pcDir and path.contains(pkgName): - return path return "" proc buildMobileIOS(srcDir = ".", params = "") =