9ee10432a4
When cross-compiling a rust package, all we need is the std library compiled for the target. This uses the final stage compiler which was built for Build and then uses that as a stage0 compiler for target std library. It also copies the rust binary from pkgsBuildBuild so that it find the new lib/rustlib directory. We also need to create a cargo wrapper which will use the "new" rust compiler Also makes sure man pages and doc pages are propagated Co-authored-by: Alyssa Ross <hi@alyssa.is> Co-authored-by: Sandro <sandro.jaeckel@gmail.com> Co-authored-by: Rick van Schijndel <Mindavi@users.noreply.github.com>
14 lines
494 B
Nix
14 lines
494 B
Nix
{ runCommand, stdenv, lib, pkgsBuildBuild, makeShellWrapper, rustc, ... }:
|
|
|
|
runCommand "${stdenv.targetPlatform.config}-cargo-${lib.getVersion pkgsBuildBuild.cargo}" {
|
|
# Use depsBuildBuild or it tries to use target-runtimeShell
|
|
depsBuildBuild = [ makeShellWrapper ];
|
|
|
|
inherit (pkgsBuildBuild.cargo) meta;
|
|
} ''
|
|
mkdir -p $out/bin
|
|
ln -s ${pkgsBuildBuild.cargo}/share $out/share
|
|
|
|
makeWrapper "${pkgsBuildBuild.cargo}/bin/cargo" "$out/bin/cargo" \
|
|
--prefix PATH : "${rustc}/bin"
|
|
''
|