mirror of
https://github.com/vacp2p/zerokit.git
synced 2026-01-08 05:13:56 -05:00
I had been trying to consume zerokit (specifically rln on x86_64), to
build libwaku (nwaku) and was having issues, this PR at least allows a
build to occur.
```bash
$ nix flake show github:vacp2p/zerokit
error: syntax error, unexpected '=', expecting ';'
at «github:vacp2p/zerokit/0b00c639a059a2cfde74bcf68fdf75db3b6898a4»/flake.nix:36:25:
35|
36| rln-linux-arm64 = buildRln {
| ^
37| target-platform = "aarch64-multiplatform";
```
`Cargo.lock` is required in repo for this to be possible, otherwise:
```bash
$ nix build .#rln --show-trace
warning: Git tree '/home/j/experiments/zerokit' is dirty
error:
… while calling the 'derivationStrict' builtin
at <nix/derivation-internal.nix>:37:12:
36|
37| strict = derivationStrict drvAttrs;
| ^
38|
… while evaluating derivation 'zerokit-nightly'
whose name attribute is located at /nix/store/fy7zcm8ya6p215wvrlqrl8022da6asn0-source/pkgs/stdenv/generic/make-derivation.nix:336:7
… while evaluating attribute 'cargoDeps' of derivation 'zerokit-nightly'
at /nix/store/fy7zcm8ya6p215wvrlqrl8022da6asn0-source/pkgs/build-support/rust/build-rust-package/default.nix:157:5:
156| // {
157| cargoDeps = cargoDeps';
| ^
158| inherit buildAndTestSubdir;
… while calling the 'getAttr' builtin
at <nix/derivation-internal.nix>:50:17:
49| value = commonAttrs // {
50| outPath = builtins.getAttr outputName strict;
| ^
51| drvPath = strict.drvPath;
… while calling the 'derivationStrict' builtin
at <nix/derivation-internal.nix>:37:12:
36|
37| strict = derivationStrict drvAttrs;
| ^
38|
… while evaluating derivation 'cargo-vendor-dir'
whose name attribute is located at /nix/store/fy7zcm8ya6p215wvrlqrl8022da6asn0-source/pkgs/stdenv/generic/make-derivation.nix:336:7
… while evaluating attribute 'buildCommand' of derivation 'cargo-vendor-dir'
at /nix/store/fy7zcm8ya6p215wvrlqrl8022da6asn0-source/pkgs/build-support/trivial-builders/default.nix:59:17:
58| enableParallelBuilding = true;
59| inherit buildCommand name;
| ^
60| passAsFile = [ "buildCommand" ]
… while calling the 'toString' builtin
at /nix/store/fy7zcm8ya6p215wvrlqrl8022da6asn0-source/pkgs/build-support/rust/import-cargo-lock.nix:264:20:
263|
264| for crate in ${toString depCrates}; do
| ^
265| # Link the crate directory, removing the output path hash from the destination.
… while calling the 'deepSeq' builtin
at /nix/store/fy7zcm8ya6p215wvrlqrl8022da6asn0-source/pkgs/build-support/rust/import-cargo-lock.nix:68:15:
67| # being evaluated otherwise, since there could be no git dependencies.
68| depCrates = builtins.deepSeq gitShaOutputHash (builtins.map mkCrate depPackages);
| ^
69|
… while calling the 'map' builtin
at /nix/store/fy7zcm8ya6p215wvrlqrl8022da6asn0-source/pkgs/build-support/rust/import-cargo-lock.nix:68:50:
67| # being evaluated otherwise, since there could be no git dependencies.
68| depCrates = builtins.deepSeq gitShaOutputHash (builtins.map mkCrate depPackages);
| ^
69|
… while calling the 'filter' builtin
at /nix/store/fy7zcm8ya6p215wvrlqrl8022da6asn0-source/pkgs/build-support/rust/import-cargo-lock.nix:61:17:
60| # safely skip it.
61| depPackages = builtins.filter (p: p ? "source") packages;
| ^
62|
… while calling the 'fromTOML' builtin
at /nix/store/fy7zcm8ya6p215wvrlqrl8022da6asn0-source/pkgs/build-support/rust/import-cargo-lock.nix:50:20:
49|
50| parsedLockFile = builtins.fromTOML lockFileContents;
| ^
51|
… while evaluating the argument passed to builtins.fromTOML
… while calling the 'readFile' builtin
at /nix/store/fy7zcm8ya6p215wvrlqrl8022da6asn0-source/pkgs/build-support/rust/import-cargo-lock.nix:47:10:
46| if lockFile != null
47| then builtins.readFile lockFile
| ^
48| else args.lockFileContents;
error: opening file '/nix/store/qh8gf0sl8znhnjwc1ksif7pwik26dsyd-source/Cargo.lock': No such file or directory
```
The PR allows for a successful build:
```bash
$ ls -R result
result:
target
result/target:
release
result/target/release:
librln.a librln.d librln.rlib librln.so
```
---------
Co-authored-by: Jarrad Hope <jarrad@logos.co>
Co-authored-by: Vinh Trịnh <108657096+vinhtc27@users.noreply.github.com>