cargo-vendor: Build from source using carnix

Removes a binary bootstrap, and enables cargo-vendor on aarch64.
This commit is contained in:
Andrew Childs 2018-01-18 00:01:04 +09:00
parent 62dcb3d5d0
commit be797f7e1c
5 changed files with 1529 additions and 39 deletions

View File

@ -1,34 +0,0 @@
{ 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
'';
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
{ callPackage, fetchFromGitHub }:
(callPackage ./cargo-vendor.nix {}).cargo_vendor_0_1_13.overrideAttrs (attrs: {
src = fetchFromGitHub {
owner = "alexcrichton";
repo = "cargo-vendor";
rev = "0.1.13";
sha256 = "0ljh2d65zpxp26a95b3czy5ai2z2dm87x7ndfdc1s0v1fsy69kn4";
};
})

View File

@ -1,9 +1,38 @@
{ pkgconfig, sqlite, openssl, ... }:
{ stdenv, pkgconfig, curl, darwin, libiconv, libgit2, libssh2,
openssl, sqlite, zlib, ... }:
let
inherit (darwin.apple_sdk.frameworks) CoreFoundation;
in
{
cargo = attrs: {
buildInputs = [ openssl zlib curl ]
++ stdenv.lib.optionals stdenv.isDarwin [ CoreFoundation libiconv ];
# TODO: buildRustCrate seems to use incorrect default inference
crateBin = [ { name = "cargo"; path = "src/bin/cargo.rs"; } ];
};
cargo-vendor = attrs: {
buildInputs = [ openssl zlib curl ];
# TODO: this defaults to cargo_vendor; needs to be cargo-vendor to
# be considered a cargo subcommand.
crateBin = [ { name = "cargo-vendor"; path = "src/main.rs"; } ];
};
curl-sys = attrs: {
buildInputs = [ pkgconfig curl ];
};
libgit2-sys = attrs: {
LIBGIT2_SYS_USE_PKG_CONFIG = true;
buildInputs = [ pkgconfig openssl zlib libgit2 ];
};
libsqlite3-sys = attrs: {
buildInputs = [ pkgconfig sqlite ];
};
libssh2-sys = attrs: {
buildInputs = [ pkgconfig openssl zlib libssh2 ];
};
openssl = attrs: {
buildInputs = [ openssl ];
};
openssl-sys = attrs: {
buildInputs = [ pkgconfig openssl ];
};

View File

@ -1,8 +1,6 @@
{ fetchurl, stdenv, path, cacert, git, rust }:
{ callPackage, fetchurl, stdenv, path, cacert, git, rust }:
let
cargoVendor = import ./cargo-vendor.nix {
inherit fetchurl stdenv;
};
cargoVendor = callPackage ./cargo-vendor {};
fetchcargo = import ./fetchcargo.nix {
inherit stdenv cacert git rust cargoVendor;