nixpkgs/pkgs/build-support/rust/cargo-vendor.nix
Vladimír Čunát 3a110ea3f9
treewide platform checks: abort -> throw
They aren't meant to be critical (uncatchable) errors.
Tested with nix-env + checkMeta:
[ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" ]
2017-12-12 18:08:10 -05:00

35 lines
880 B
Nix

{ fetchurl, stdenv }:
let
inherit (stdenv) system;
version = "0.1.12";
hashes = {
x86_64-linux = "1hxlavcxy374yypfamlkygjg662lhll8j434qcvdawkvlidg5ii5";
x86_64-darwin = "1jkvhh710gwjnnjx59kaplx2ncfvkx9agfa76rr94sbjqq4igddm";
};
hash = hashes. ${system} or badSystem;
badSystem = throw "missing bootstrap hash for platform ${system}";
platforms = {
x86_64-linux = "x86_64-unknown-linux-musl";
x86_64-darwin = "x86_64-apple-darwin";
};
platform = platforms . ${system} or badSystem;
in stdenv.mkDerivation {
name = "cargo-vendor-${version}";
src = fetchurl {
url = "https://github.com/alexcrichton/cargo-vendor/releases/download/${version}/cargo-vendor-${version}-${platform}.tar.gz";
sha256 = hash;
};
phases = "unpackPhase installPhase";
installPhase = ''
install -Dm755 cargo-vendor $out/bin/cargo-vendor
'';
}