build-support/rust: Organize
- `toRustTarget` and friends pulled out from rust tools into rust library. Since they don't depend on any packages they can be more widely useable. - `build-rust-package` gets its own directory - `fetch-cargo-tarball` gets its own directory (cherry picked from commit 18ed048c7b27e288a6c9ba894790a7e67ed5080d)
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p python3 python3.pkgs.toml cargo
|
||||
|
||||
set -e
|
||||
|
||||
HERE=$(dirname "${BASH_SOURCE[0]}")
|
||||
NIXPKGS_ROOT="$HERE/../../../.."
|
||||
|
||||
# https://unix.stackexchange.com/a/84980/390173
|
||||
tempdir=$(mktemp -d 2>/dev/null || mktemp -d -t 'update-lockfile')
|
||||
|
||||
cd "$tempdir"
|
||||
nix-build -E "with import (/. + \"${NIXPKGS_ROOT}\") {}; pkgs.rustPlatform.rustcSrc.override { minimalContent = false; }"
|
||||
RUSTC_SRC="$(pwd)/result" python3 "$HERE/cargo.py"
|
||||
RUSTC_BOOTSTRAP=1 cargo build || echo "Build failure is expected. All that's needed is the lockfile."
|
||||
|
||||
cp Cargo.lock "$HERE"
|
||||
|
||||
rm -rf "$tempdir"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user