mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-29 06:45:54 +03:00
Merge pull request #33980 from thefloweringash/cargo-vendor-carnix
cargo-vendor: Build from source using carnix
This commit is contained in:
commit
8ee54334e9
@ -297,9 +297,15 @@ in
|
||||
crate_: lib.makeOverridable ({ rust, release, verbose, features, buildInputs, crateOverrides }:
|
||||
|
||||
let crate = crate_ // (lib.attrByPath [ crate_.crateName ] (attr: {}) crateOverrides crate_);
|
||||
processedAttrs = [
|
||||
"src" "buildInputs" "crateBin" "crateLib" "libName" "libPath"
|
||||
"buildDependencies" "dependencies" "features"
|
||||
"crateName" "version" "build" "authors" "colors"
|
||||
];
|
||||
extraDerivationAttrs = lib.filterAttrs (n: v: ! lib.elem n processedAttrs) crate;
|
||||
buildInputs_ = buildInputs;
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
stdenv.mkDerivation (rec {
|
||||
|
||||
inherit (crate) crateName;
|
||||
|
||||
@ -372,7 +378,7 @@ stdenv.mkDerivation rec {
|
||||
};
|
||||
installPhase = installCrate crateName;
|
||||
|
||||
}) {
|
||||
} // extraDerivationAttrs)) {
|
||||
rust = rustc;
|
||||
release = true;
|
||||
verbose = true;
|
||||
|
@ -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
|
||||
'';
|
||||
}
|
1487
pkgs/build-support/rust/cargo-vendor/cargo-vendor.nix
Normal file
1487
pkgs/build-support/rust/cargo-vendor/cargo-vendor.nix
Normal file
File diff suppressed because it is too large
Load Diff
10
pkgs/build-support/rust/cargo-vendor/default.nix
Normal file
10
pkgs/build-support/rust/cargo-vendor/default.nix
Normal 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";
|
||||
};
|
||||
})
|
@ -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 ];
|
||||
};
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user