at 24.11-pre 27 lines 600 B view raw
1#!/usr/bin/env nix-shell 2#!nix-shell -i bash -p python3 python3.pkgs.toml cargo 3 4set -eu pipefile 5 6HERE=$(readlink -e $(dirname "${BASH_SOURCE[0]}")) 7NIXPKGS_ROOT="$HERE/../../../.." 8 9# https://unix.stackexchange.com/a/84980/390173 10tempdir=$(mktemp -d 2>/dev/null || mktemp -d -t 'update-lockfile') 11cd "$tempdir" 12mkdir -p src 13touch src/lib.rs 14 15RUSTC_SRC=$(nix-build "${NIXPKGS_ROOT}" -A pkgs.rustPlatform.rustLibSrc --no-out-link) 16 17ln -s $RUSTC_SRC/{core,alloc} ./ 18 19export RUSTC_SRC 20python3 "$HERE/cargo.py" 21 22export RUSTC_BOOTSTRAP=1 23cargo generate-lockfile 24 25cp Cargo.lock "$HERE" 26 27rm -rf "$tempdir"