From f72437c573f27242148cdc364f2475473de80db2 Mon Sep 17 00:00:00 2001 From: Ivan FB Date: Sat, 4 Apr 2026 16:56:20 +0200 Subject: [PATCH] adapt nim.nix and nimble.nix to two previous commits --- nix/nim.nix | 14 ++++++++------ nix/nimble.nix | 14 ++++++++------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/nix/nim.nix b/nix/nim.nix index 0b9a14033..48c311cb0 100644 --- a/nix/nim.nix +++ b/nix/nim.nix @@ -1,17 +1,19 @@ -# Fetches the Nim source tree at the exact revision pinned in nimble.lock. +# Fetches the Nim source tree at the exact revision declared in waku.nimble. # The compiler binary is still pkgs.nim-2_2 (pre-built); this source is # used to pin the stdlib to the same commit. # Regenerate sha256 with: # nix shell nixpkgs#nix-prefetch-git --command \ -# nix-prefetch-git --url --rev --fetch-submodules +# nix-prefetch-git --url https://github.com/nim-lang/Nim.git --rev v --fetch-submodules { pkgs }: let - lock = builtins.fromJSON (builtins.readFile ../nimble.lock); - entry = lock.packages.nim; + lines = pkgs.lib.splitString "\n" (builtins.readFile ../waku.nimble); + versionLine = builtins.head (builtins.filter + (l: builtins.match "^const NimVersion.*" l != null) lines); + version = builtins.head (builtins.match ".*\"([0-9]+\\.[0-9]+\\.[0-9]+)\".*" versionLine); in pkgs.fetchgit { - url = entry.url; - rev = "v${entry.version}"; + url = "https://github.com/nim-lang/Nim.git"; + rev = "v${version}"; sha256 = "1g4nxbwbc6h174gbpa3gcs47xwk6scbmiqlp0nq1ig3af8fcqcnj"; fetchSubmodules = true; } diff --git a/nix/nimble.nix b/nix/nimble.nix index 218ae8216..242173cd4 100644 --- a/nix/nimble.nix +++ b/nix/nimble.nix @@ -1,15 +1,17 @@ -# Fetches Nimble at the exact revision pinned in nimble.lock. +# Fetches Nimble at the exact revision declared in waku.nimble. # Regenerate sha256 with: # nix shell nixpkgs#nix-prefetch-git --command \ -# nix-prefetch-git --url --rev --fetch-submodules +# nix-prefetch-git --url https://github.com/nim-lang/nimble --rev v --fetch-submodules { pkgs }: let - lock = builtins.fromJSON (builtins.readFile ../nimble.lock); - entry = lock.packages.nimble; + lines = pkgs.lib.splitString "\n" (builtins.readFile ../waku.nimble); + versionLine = builtins.head (builtins.filter + (l: builtins.match "^const NimbleVersion.*" l != null) lines); + version = builtins.head (builtins.match ".*\"([0-9]+\\.[0-9]+\\.[0-9]+)\".*" versionLine); in pkgs.fetchgit { - url = entry.url; - rev = "v${entry.version}"; + url = "https://github.com/nim-lang/nimble"; + rev = "v${version}"; sha256 = "18cwsjwcgjmnm42kr310hfbw06lym3vaj641i4pla6r8w22xqpqd"; fetchSubmodules = true; }