Loading doc/languages-frameworks/rust.section.md +29 −0 Original line number Diff line number Diff line Loading @@ -736,6 +736,35 @@ stdenv.mkDerivation (finalAttrs: { }) ``` ### Compiling `wasm32-wasip1` package {#compiling-wasm32-wasip1-package} ```nix pkgsCross.wasi32.callPackage ( { fetchFromGitHub, rustPlatform, lld, }: rustPlatform.buildRustPackage (finalAttrs: { pname = "zellij-harpoon"; version = "0.3.0"; src = fetchFromGitHub { owner = "Nacho114"; repo = "harpoon"; tag = "v${finalAttrs.version}"; hash = "sha256-JmYcbzxIF6qZs2/RKuspHqNpyDibGp9CVQJj47y/BOQ="; }; cargoHash = "sha256-lsv5Wssakni18jif++fPo3Z5WyBtvPsGpWwG3abR7jQ="; # these two lines are currently required env.RUSTFLAGS = "-C linker=wasm-ld"; nativeBuildInputs = [ lld ]; }) ) { } ``` ## `buildRustCrate`: Compiling Rust crates using Nix instead of Cargo {#compiling-rust-crates-using-nix-instead-of-cargo} ### Simple operation {#simple-operation} Loading doc/redirects.json +3 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,9 @@ "cmake-ctest-variables": [ "index.html#cmake-ctest-variables" ], "compiling-wasm32-wasip1-package": [ "index.html#compiling-wasm32-wasip1-package" ], "coq-withPackages": [ "index.html#coq-withPackages" ], Loading pkgs/by-name/wa/wasilibc/package.nix +5 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ stdenvNoLibc.mkDerivation (finalAttrs: { "SYSROOT_LIB:=$SYSROOT_LIB" "SYSROOT_INC:=$SYSROOT_INC" "SYSROOT_SHARE:=$SYSROOT_SHARE" "TARGET_TRIPLE:=${stdenvNoLibc.system}" ${lib.strings.optionalString enablePosixThreads "THREAD_MODEL:=posix"} ) ''; Loading @@ -58,6 +59,10 @@ stdenvNoLibc.mkDerivation (finalAttrs: { preFixup = '' ln -s $share/share/undefined-symbols.txt $out/lib/wasi.imports ln -s $out/lib $out/lib/${stdenvNoLibc.system} '' + lib.optionalString (stdenvNoLibc.system != stdenvNoLibc.targetPlatform.rust.rustcTargetSpec) '' ln -s $out/lib $out/lib/${stdenvNoLibc.targetPlatform.rust.rustcTargetSpec} ''; passthru.tests = { Loading pkgs/development/compilers/rust/rustc.nix +3 −0 Original line number Diff line number Diff line Loading @@ -260,6 +260,9 @@ stdenv.mkDerivation (finalAttrs: { ++ optionals stdenv.targetPlatform.isMusl [ "${setTarget}.musl-root=${pkgsBuildTarget.targetPackages.stdenv.cc.libc}" ] ++ optionals stdenv.targetPlatform.isWasi [ "${setTarget}.wasi-root=${pkgsBuildTarget.targetPackages.stdenv.cc.libc}" ] ++ optionals stdenv.targetPlatform.rust.isNoStdTarget [ "--disable-docs" ] Loading Loading
doc/languages-frameworks/rust.section.md +29 −0 Original line number Diff line number Diff line Loading @@ -736,6 +736,35 @@ stdenv.mkDerivation (finalAttrs: { }) ``` ### Compiling `wasm32-wasip1` package {#compiling-wasm32-wasip1-package} ```nix pkgsCross.wasi32.callPackage ( { fetchFromGitHub, rustPlatform, lld, }: rustPlatform.buildRustPackage (finalAttrs: { pname = "zellij-harpoon"; version = "0.3.0"; src = fetchFromGitHub { owner = "Nacho114"; repo = "harpoon"; tag = "v${finalAttrs.version}"; hash = "sha256-JmYcbzxIF6qZs2/RKuspHqNpyDibGp9CVQJj47y/BOQ="; }; cargoHash = "sha256-lsv5Wssakni18jif++fPo3Z5WyBtvPsGpWwG3abR7jQ="; # these two lines are currently required env.RUSTFLAGS = "-C linker=wasm-ld"; nativeBuildInputs = [ lld ]; }) ) { } ``` ## `buildRustCrate`: Compiling Rust crates using Nix instead of Cargo {#compiling-rust-crates-using-nix-instead-of-cargo} ### Simple operation {#simple-operation} Loading
doc/redirects.json +3 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,9 @@ "cmake-ctest-variables": [ "index.html#cmake-ctest-variables" ], "compiling-wasm32-wasip1-package": [ "index.html#compiling-wasm32-wasip1-package" ], "coq-withPackages": [ "index.html#coq-withPackages" ], Loading
pkgs/by-name/wa/wasilibc/package.nix +5 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ stdenvNoLibc.mkDerivation (finalAttrs: { "SYSROOT_LIB:=$SYSROOT_LIB" "SYSROOT_INC:=$SYSROOT_INC" "SYSROOT_SHARE:=$SYSROOT_SHARE" "TARGET_TRIPLE:=${stdenvNoLibc.system}" ${lib.strings.optionalString enablePosixThreads "THREAD_MODEL:=posix"} ) ''; Loading @@ -58,6 +59,10 @@ stdenvNoLibc.mkDerivation (finalAttrs: { preFixup = '' ln -s $share/share/undefined-symbols.txt $out/lib/wasi.imports ln -s $out/lib $out/lib/${stdenvNoLibc.system} '' + lib.optionalString (stdenvNoLibc.system != stdenvNoLibc.targetPlatform.rust.rustcTargetSpec) '' ln -s $out/lib $out/lib/${stdenvNoLibc.targetPlatform.rust.rustcTargetSpec} ''; passthru.tests = { Loading
pkgs/development/compilers/rust/rustc.nix +3 −0 Original line number Diff line number Diff line Loading @@ -260,6 +260,9 @@ stdenv.mkDerivation (finalAttrs: { ++ optionals stdenv.targetPlatform.isMusl [ "${setTarget}.musl-root=${pkgsBuildTarget.targetPackages.stdenv.cc.libc}" ] ++ optionals stdenv.targetPlatform.isWasi [ "${setTarget}.wasi-root=${pkgsBuildTarget.targetPackages.stdenv.cc.libc}" ] ++ optionals stdenv.targetPlatform.rust.isNoStdTarget [ "--disable-docs" ] Loading