fix(nix): make the CBOR build Nix-buildable offline

The Nix build pre-populates deps into pkgs2 and can't clone in the sandbox.
nim-ffi isn't in the nimble registry, so requiring it by URL made nimble
re-clone it during resolution (offline -> fail). Resolve ffi by name from the
installed pkgs2 in the Nix build (gated by SDS_NIX_DEPS), keeping the URL fetch
for plain `nimble` builds; the URL now points at the published v0.2.0-rc.1 tag.

Also drop the `nim` entry from the lock (the sandbox can't fetch Nim by SHA),
record numeric lock versions for ffi (0.2.0) and cbor_serialization (0.3.0) so
they resolve cleanly, and regenerate nix/deps.nix to include cbor_serialization.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Ivan FB 2026-06-20 02:45:50 +02:00
parent e3b49d18a2
commit 2a2e549c2b
No known key found for this signature in database
GPG Key ID: DF0C67A04C543270
4 changed files with 64 additions and 60 deletions

View File

@ -1,16 +1,6 @@
{
"version": 2,
"packages": {
"nim": {
"version": "2.2.10",
"vcsRevision": "9fe2137fa2f3f66cf5a44f357d461829ac9e20c4",
"url": "https://github.com/nim-lang/Nim.git",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "17ec440fdb89f8903db29a17898af590087d2b64"
}
},
"unittest2": {
"version": "0.2.5",
"vcsRevision": "26f2ef3ae0ec72a2a75bfe557e02e88f6a31c189",
@ -181,7 +171,7 @@
}
},
"cbor_serialization": {
"version": "#v0.3.0",
"version": "0.3.0",
"vcsRevision": "1664160e04d153573373afddc552b9cbf6fbe4dc",
"url": "https://github.com/vacp2p/nim-cbor-serialization",
"downloadMethod": "git",
@ -254,7 +244,7 @@
}
},
"ffi": {
"version": "#fix/foreign-host-concurrency-v0.2",
"version": "0.2.0",
"vcsRevision": "c3d135f46f809e09602d44f48949c2a4b2688e37",
"url": "https://github.com/logos-messaging/nim-ffi",
"downloadMethod": "git",

View File

@ -81,6 +81,7 @@ in stdenv.mkDerivation {
version = "${version}-${revision}";
env = {
SDS_NIX_DEPS = "1";
NIMFLAGS = "-d:disableMarchNative";
ANDROID_SDK_ROOT = optionalString isAndroidBuild pkgs.androidPkgs.sdk;
ANDROID_NDK_ROOT = optionalString isAndroidBuild pkgs.androidPkgs.ndk;

View File

@ -12,8 +12,22 @@
bearssl = pkgs.fetchgit {
url = "https://github.com/status-im/nim-bearssl";
rev = "11e798b62b8e6beabe958e048e9e24c7e0f9ee63";
sha256 = "0qx36iiawrhmx9qjqcyfvz0134ph9dy8ryq3ch8d31gq6ir7aw84";
rev = "22c6a76ce015bc07e011562bdcfc51d9446c1e82";
sha256 = "1cvdd7lfrpa6asmc39al3g4py5nqhpqmvypc36r5qyv7p5arc8a3";
fetchSubmodules = true;
};
testutils = pkgs.fetchgit {
url = "https://github.com/status-im/nim-testutils";
rev = "6ce5e5e2301ccbc04b09d27ff78741ff4d352b4d";
sha256 = "1vbkr6i5yxhc2ai3b7rbglhmyc98f99x874fqdp6a152a6kqgwxy";
fetchSubmodules = true;
};
npeg = pkgs.fetchgit {
url = "https://github.com/zevv/npeg";
rev = "409f6796d0e880b3f0222c964d1da7de6e450811";
sha256 = "1h2f5znbpa3svk7wsw2axn8f7f59d23xq85z148kiv6fqh0ffwbm";
fetchSubmodules = true;
};
@ -26,36 +40,57 @@
stew = pkgs.fetchgit {
url = "https://github.com/status-im/nim-stew";
rev = "b66168735d6f3841c5239c3169d3fe5fe98b1257";
sha256 = "10n71vfa6klzd9dmal96jy0hiqk04gaj8wc9g91z6fclryf0yq92";
rev = "4382b18f04b3c43c8409bfcd6b62063773b2bbaa";
sha256 = "0mx9g5m636h3sk5pllcpylk51brf7lx91izx3gc23k3ih3hrxyk2";
fetchSubmodules = true;
};
httputils = pkgs.fetchgit {
url = "https://github.com/status-im/nim-http-utils";
rev = "f142cb2e8bd812dd002a6493b6082827bb248592";
sha256 = "03msj4zdxraz4qx9cidb17g7v0asazxv91nng6xxbzjxz0qaqxw6";
fetchSubmodules = true;
};
chronos = pkgs.fetchgit {
url = "https://github.com/status-im/nim-chronos";
rev = "45f43a9ad8bd8bcf5903b42f365c1c879bd54240";
sha256 = "1v1n59zfzznp97pvwgs9kf136bqmv4x2s2y9f24msspa7qv27w39";
fetchSubmodules = true;
};
metrics = pkgs.fetchgit {
url = "https://github.com/status-im/nim-metrics";
rev = "a1296caf3ebb5f30f51a5feae7749a30df2824c2";
sha256 = "02vxqy20g8012ks939ac25ksc25k727q84si0p2cmihy5bw1a3qm";
fetchSubmodules = true;
};
faststreams = pkgs.fetchgit {
url = "https://github.com/status-im/nim-faststreams";
rev = "ce27581a3e881f782f482cb66dc5b07a02bd615e";
sha256 = "0y6bw2scnmr8cxj4fg18w7f34l2bh9qwg5nhlgd84m9fpr5bqarn";
rev = "50889cd16ec8771106cdd0eeea460039e8571e06";
sha256 = "1hd4bhvw5lzwg924i8dif5mi61h0ayiplq38djvrdbfsjdhw2zvw";
fetchSubmodules = true;
};
serialization = pkgs.fetchgit {
url = "https://github.com/status-im/nim-serialization";
rev = "b0f2fa32960ea532a184394b0f27be37bd80248b";
sha256 = "0wip1fjx7ka39ck1g1xvmyarzq1p5dlngpqil6zff8k8z5skiz27";
fetchSubmodules = true;
};
npeg = pkgs.fetchgit {
url = "https://github.com/zevv/npeg";
rev = "409f6796d0e880b3f0222c964d1da7de6e450811";
sha256 = "1h2f5znbpa3svk7wsw2axn8f7f59d23xq85z148kiv6fqh0ffwbm";
rev = "4092500cea76154576539371709ae801afbd2a9d";
sha256 = "04pz6d6p3nd1y2khbb667fcd6p2jk4bxv65iaffzq06bqqhalcwc";
fetchSubmodules = true;
};
protobuf_serialization = pkgs.fetchgit {
url = "https://github.com/status-im/nim-protobuf-serialization";
rev = "d9aa950b9d9e8bfc8a201740042b5e8ea5880875";
sha256 = "11hrqpq7dpdqfn71izmq7ysrdnh8gry0qvrgqdspcz2k2lifzz0c";
rev = "cec5f1da897c0b3e6d3a1f2da6a36b4bbdc3a1a8";
sha256 = "0dmrm8l1293fcmyzm4kmhwplyrd1clrjs8hpf9s9bpbyjw7vf927";
fetchSubmodules = true;
};
cbor_serialization = pkgs.fetchgit {
url = "https://github.com/vacp2p/nim-cbor-serialization";
rev = "1664160e04d153573373afddc552b9cbf6fbe4dc";
sha256 = "0c1rj4fk0fcqvsf0yqhxvm8h10aww75gi4yfsjhlczh88ypywii2";
fetchSubmodules = true;
};
@ -66,13 +101,6 @@
fetchSubmodules = true;
};
testutils = pkgs.fetchgit {
url = "https://github.com/status-im/nim-testutils";
rev = "e4d37dc1652d5c63afb89907efb5a5e812261797";
sha256 = "0nv0a9jm5b1rn3y52cxvyj8xz3jg235mp0xbirfp2cda0icgy1si";
fetchSubmodules = true;
};
chronicles = pkgs.fetchgit {
url = "https://github.com/status-im/nim-chronicles";
rev = "27ec507429a4eb81edc20f28292ee8ec420be05b";
@ -80,27 +108,6 @@
fetchSubmodules = true;
};
httputils = pkgs.fetchgit {
url = "https://github.com/status-im/nim-http-utils";
rev = "c53852d9e24205b6363bba517fa8ee7bde823691";
sha256 = "1b332smfyp2yvhvfjrfqy4kvh9pc5w6hqh17f1yclz5z1j5xdpf1";
fetchSubmodules = true;
};
chronos = pkgs.fetchgit {
url = "https://github.com/status-im/nim-chronos";
rev = "0646c444fce7c7ed08ef6f2c9a7abfd172ffe655";
sha256 = "1r499jl0lhnjq7hgddwgjl0gh3y1mprnqkhk0h6yh3cwgsmr5ym9";
fetchSubmodules = true;
};
metrics = pkgs.fetchgit {
url = "https://github.com/status-im/nim-metrics";
rev = "11d0cddfb0e711aa2a8c75d1892ae24a64c299fc";
sha256 = "1jrf2cf7v3iqjsk6grzvivxic1shhaxnvab6d35rxs2kcy6b5dv0";
fetchSubmodules = true;
};
stint = pkgs.fetchgit {
url = "https://github.com/status-im/nim-stint";
rev = "470b7892561b5179ab20bd389a69217d6213fe58";
@ -117,8 +124,8 @@
ffi = pkgs.fetchgit {
url = "https://github.com/logos-messaging/nim-ffi";
rev = "d4c87c1f94c4678eea7d32a8f5f41c72420fadb6";
sha256 = "14dm92l3wl8sc5a108612r1cgjvxksy2chzmn1asph6frl4lm641";
rev = "c3d135f46f809e09602d44f48949c2a4b2688e37";
sha256 = "0463f7xpnjh14caxlxi3ipvkp6csgadc83jvlg41idg494bp0g8s";
fetchSubmodules = true;
};

View File

@ -16,7 +16,13 @@ requires "stew"
requires "stint"
requires "metrics"
requires "results"
requires "https://github.com/logos-messaging/nim-ffi#fix/foreign-host-concurrency-v0.2"
# nim-ffi isn't in the nimble registry, so a plain `nimble` build fetches it by
# URL. The Nix build pre-populates deps offline (can't clone) and sets
# SDS_NIX_DEPS to resolve it by name from the installed pkgs2 instead.
when existsEnv("SDS_NIX_DEPS"):
requires "ffi >= 0.2.0"
else:
requires "https://github.com/logos-messaging/nim-ffi#v0.2.0-rc.1"
requires "https://github.com/vacp2p/nim-cbor-serialization#v0.3.0"
proc buildLibrary(