diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0fa1730b5..a903982f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -88,14 +88,6 @@ jobs: - name: Install nimble deps if: steps.cache-nimbledeps.outputs.cache-hit != 'true' run: | - # Remove nim/nimble entries from lock to avoid cross-platform checksum mismatch - python3 -c " - import json, sys - lock = json.load(open('nimble.lock')) - for key in ['nim', 'nimble']: - lock['packages'].pop(key, None) - json.dump(lock, open('nimble.lock', 'w'), indent=2) - " nimble setup --localdeps -y make rebuild-nat-libs-nimbledeps make rebuild-bearssl-nimbledeps @@ -149,14 +141,6 @@ jobs: - name: Install nimble deps if: steps.cache-nimbledeps.outputs.cache-hit != 'true' run: | - # Remove nim/nimble entries from lock to avoid cross-platform checksum mismatch - python3 -c " - import json, sys - lock = json.load(open('nimble.lock')) - for key in ['nim', 'nimble']: - lock['packages'].pop(key, None) - json.dump(lock, open('nimble.lock', 'w'), indent=2) - " nimble setup --localdeps -y make rebuild-nat-libs-nimbledeps make rebuild-bearssl-nimbledeps @@ -236,14 +220,6 @@ jobs: - name: Install nimble deps if: steps.cache-nimbledeps.outputs.cache-hit != 'true' run: | - # Remove nim/nimble entries from lock to avoid cross-platform checksum mismatch - python3 -c " - import json, sys - lock = json.load(open('nimble.lock')) - for key in ['nim', 'nimble']: - lock['packages'].pop(key, None) - json.dump(lock, open('nimble.lock', 'w'), indent=2) - " nimble setup --localdeps -y make rebuild-nat-libs-nimbledeps make rebuild-bearssl-nimbledeps diff --git a/.github/workflows/container-image.yml b/.github/workflows/container-image.yml index c261d3e8d..ae132a477 100644 --- a/.github/workflows/container-image.yml +++ b/.github/workflows/container-image.yml @@ -74,14 +74,6 @@ jobs: - name: Install nimble deps if: ${{ steps.secrets.outcome == 'success' && steps.cache-nimbledeps.outputs.cache-hit != 'true' }} run: | - # Remove nim/nimble entries from lock to avoid cross-platform checksum mismatch - python3 -c " - import json, sys - lock = json.load(open('nimble.lock')) - for key in ['nim', 'nimble']: - lock['packages'].pop(key, None) - json.dump(lock, open('nimble.lock', 'w'), indent=2) - " nimble setup --localdeps -y make rebuild-nat-libs-nimbledeps make rebuild-bearssl-nimbledeps diff --git a/Makefile b/Makefile index 016428fb8..0c32da864 100644 --- a/Makefile +++ b/Makefile @@ -67,12 +67,7 @@ waku.nims: ln -s waku.nimble $@ $(NIMBLEDEPS_STAMP): nimble.lock | waku.nims - # nim/nimble in nimble.lock have platform-specific checksums; strip before - # setup and restore afterwards to keep the versioned file intact. - cp nimble.lock nimble.lock.bak - python3 -c "import json; lock=json.load(open('nimble.lock')); [lock['packages'].pop(k,None) for k in ['nim','nimble']]; json.dump(lock,open('nimble.lock','w'),indent=2)" - nimble setup --localdeps || { mv nimble.lock.bak nimble.lock; exit 1; } - mv nimble.lock.bak nimble.lock + nimble setup --localdeps $(MAKE) build-nph $(MAKE) rebuild-bearssl-nimbledeps touch $@ @@ -90,8 +85,8 @@ clean: rm nimble.paths 2> /dev/null || true nimble clean -REQUIRED_NIM_VERSION := $(shell grep -E '^requires "nim ==' waku.nimble | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') -REQUIRED_NIMBLE_VERSION := $(shell grep -E '^requires "nimble ==' waku.nimble | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') +REQUIRED_NIM_VERSION := $(shell grep -E '^const NimVersion\s*=' waku.nimble | grep -oE '"[0-9]+\.[0-9]+\.[0-9]+"' | tr -d '"') +REQUIRED_NIMBLE_VERSION := $(shell grep -E '^const NimbleVersion\s*=' waku.nimble | grep -oE '"[0-9]+\.[0-9]+\.[0-9]+"' | tr -d '"') build: @nim_ver=$$(nim --version 2>/dev/null | head -1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1); \ diff --git a/nix/nim.nix b/nix/nim.nix index 9e3bd823c..4bed28f4c 100644 --- a/nix/nim.nix +++ b/nix/nim.nix @@ -8,8 +8,8 @@ let lines = pkgs.lib.splitString "\n" (builtins.readFile ../waku.nimble); versionLine = builtins.head (builtins.filter - (l: builtins.match "^requires \"nim ==.*" l != null) lines); - version = builtins.head (builtins.match ".*([0-9]+\\.[0-9]+\\.[0-9]+).*" versionLine); + (l: builtins.match "^const NimVersion.*" l != null) lines); + version = builtins.head (builtins.match ".*\"([0-9]+\\.[0-9]+\\.[0-9]+)\".*" versionLine); in pkgs.fetchgit { url = "https://github.com/nim-lang/Nim.git"; diff --git a/nix/nimble.nix b/nix/nimble.nix index 3a773aa5a..242173cd4 100644 --- a/nix/nimble.nix +++ b/nix/nimble.nix @@ -6,8 +6,8 @@ let lines = pkgs.lib.splitString "\n" (builtins.readFile ../waku.nimble); versionLine = builtins.head (builtins.filter - (l: builtins.match "^requires \"nimble ==.*" l != null) lines); - version = builtins.head (builtins.match ".*([0-9]+\\.[0-9]+\\.[0-9]+).*" versionLine); + (l: builtins.match "^const NimbleVersion.*" l != null) lines); + version = builtins.head (builtins.match ".*\"([0-9]+\\.[0-9]+\\.[0-9]+)\".*" versionLine); in pkgs.fetchgit { url = "https://github.com/nim-lang/nimble"; diff --git a/waku.nimble b/waku.nimble index 659b5fc94..43e6d020d 100644 --- a/waku.nimble +++ b/waku.nimble @@ -10,9 +10,8 @@ description = "Waku, Private P2P Messaging for Resource-Restricted Devices" license = "MIT or Apache License 2.0" #bin = @["build/waku"] -## nim/nimble are stripped from nimble.lock before setup to avoid cross-platform checksum errors. -requires "nim == 2.2.4" -requires "nimble == 0.18.2" +const NimVersion = "2.2.4" +const NimbleVersion = "0.18.2" ### Dependencies requires "chronos >= 4.2.0",