refactor how nim compiler is provided in nix

This commit is contained in:
Ivan FB 2026-04-08 10:26:15 +02:00
parent f76e50b081
commit b1ae7a894f
No known key found for this signature in database
GPG Key ID: DF0C67A04C543270
4 changed files with 2 additions and 43 deletions

View File

@ -2,8 +2,6 @@
let
deps = import ./deps.nix { inherit pkgs; };
nimSrc = pkgs.callPackage ./nim.nix {};
nimbleSrc = pkgs.callPackage ./nimble.nix {};
# nat_traversal is excluded from the static pathArgs; it is handled
# separately in buildPhase (its bundled C libs must be compiled first).
@ -62,8 +60,6 @@ pkgs.stdenv.mkDerivation {
${pathArgs} \
--path:$NAT_TRAV \
--path:$NAT_TRAV/src \
--lib:${nimSrc}/lib \
--nimblePath:${nimbleSrc} \
--passL:"-L${zerokitRln}/lib -lrln" \
--define:disable_libbacktrace \
--out:build/liblogosdelivery.${libExt} \
@ -83,8 +79,6 @@ pkgs.stdenv.mkDerivation {
${pathArgs} \
--path:$NAT_TRAV \
--path:$NAT_TRAV/src \
--lib:${nimSrc}/lib \
--nimblePath:${nimbleSrc} \
--passL:"-L${zerokitRln}/lib -lrln" \
--define:disable_libbacktrace \
--out:build/liblogosdelivery.a \

View File

@ -1,19 +0,0 @@
# 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 https://github.com/nim-lang/Nim.git --rev v<version> --fetch-submodules
{ pkgs }:
let
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 = "https://github.com/nim-lang/Nim.git";
rev = "v${version}";
sha256 = "1g4nxbwbc6h174gbpa3gcs47xwk6scbmiqlp0nq1ig3af8fcqcnj";
fetchSubmodules = true;
}

View File

@ -1,17 +0,0 @@
# Fetches Nimble at the exact revision declared in waku.nimble.
# Regenerate hash with:
# nix store prefetch-file --hash-type sha256 --unpack \
# https://github.com/nim-lang/nimble/archive/v<version>.tar.gz
# or set hash = "" and let Nix report the correct value.
{ pkgs }:
let
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 = "https://github.com/nim-lang/nimble";
rev = "v${version}";
hash = "sha256-wgzFhModFkwB8st8F5vSkua7dITGGC2cjoDvgkRVZMs=";
}

View File

@ -14,6 +14,7 @@ pkgs.mkShell {
rustup
rustc
cmake
nim-unwrapped-2_2
nim-2_2
nimble
];
}