nix-community / fenix

Rust toolchains and rust-analyzer nightly for Nix [maintainer=@figsoda]
Mozilla Public License 2.0
608 stars 39 forks source link

Not sure I'm using fenix correctly for targetting `wasm32-wasi` #143

Open augustebaum opened 3 months ago

augustebaum commented 3 months ago

I'm trying to package javy with Nix, with the help of fenix because it needs the wasm32-wasi toolchain. I'm not using flakes, and there doesn't seem to be an example that exactly covers my use-case. Here's my default.nix:

let
  # sources.nix is generated using `niv`
  sources = import ./sources.nix {};
  pkgs = import sources.nixpkgs {};

  fenix = import sources.fenix {};
  toolchain = fenix.targets.wasm32-wasi.stable.toolchain;
in {
  javy = pkgs.callPackage ./javy.nix {
    rustPlatform = pkgs.makeRustPlatform {
      cargo = toolchain;
      rustc = toolchain;
    };
  };
}

I'm not sure if I'm using fenix correctly.

If I am, maybe you can help me with the error I'm getting when I reach this line in the buildPhase:

cargo build --package="javy-core" --target="wasm32-wasi" --release
javy> /nix/store/<hash>-cargo/bin/cargo: line 3: /nix/store/<hash>-cargo/bin/cargo: Argument list too long

Full stack trace:

this derivation will be built:
  /nix/store/mz3z3faan13f0a8304ndx2hv761vf0bc-javy-unstable-2024-03-05.drv
javy> building '/nix/store/mz3z3faan13f0a8304ndx2hv761vf0bc-javy-unstable-2024-03-05.drv'
javy> unpacking sources
javy> unpacking source archive /nix/store/qrqgf1i1pi2kw0n3pvfndcddv6minh2i-source
javy> source root is source
javy> Executing cargoSetupPostUnpackHook
javy> unpacking source archive /nix/store/xhvk181l0lvhsvxip3nahcnsynzc5zxm-javy-unstable-2024-03-05-vendor.tar.gz
javy> Finished cargoSetupPostUnpackHook
javy> patching sources
javy> Executing cargoSetupPostPatchHook
javy> Validating consistency between /build/source/Cargo.lock and /build/javy-unstable-2024-03-05-vendor.tar.gz/Cargo.lock
javy> Finished cargoSetupPostPatchHook
javy> configuring
javy> building
javy> /nix/store/923a1kaypjsk2dz4qjj6anxylk8127xd-cargo/bin/cargo: line 3: /nix/store/923a1kaypjsk2dz4qjj6anxylk8127xd-cargo/bin/cargo: Argument list too long
javy> /nix/store/923a1kaypjsk2dz4qjj6anxylk8127xd-cargo/bin/cargo: line 3: /nix/store/923a1kaypjsk2dz4qjj6anxylk8127xd-cargo/bin/cargo: Success
error: builder for '/nix/store/mz3z3faan13f0a8304ndx2hv761vf0bc-javy-unstable-2024-03-05.drv' failed with exit code 126;

Will appreciate any help. Thanks for reading (and for fenix)!

eureka-cpu commented 2 months ago

Try adding the -L option, it may give you more information about the error