cargo-raze: 0.16.0 -> 0.16.1, unbreak, modernize

Contains the same fix as in #310673 and #310125 that allows it to build
on Rust >1.76. However, I think this patch might have to be a permanent
one as upstream has been abandoned and unmaintained.

Also removed some spurious `with lib;` and `rec` use, moved to use
`pkgs/by-name` and reformatted using `nixfmt-rfc-style`.
This commit is contained in:
Leah Amelia Chen 2024-05-13 13:57:02 +02:00
parent 7689655b82
commit 059f2de9db
4 changed files with 84 additions and 51 deletions

View File

@ -0,0 +1,55 @@
{
lib,
stdenv,
fetchFromGitHub,
rustPlatform,
pkg-config,
curl,
libgit2,
openssl,
darwin,
}:
let
version = "0.16.1";
src = fetchFromGitHub {
owner = "google";
repo = "cargo-raze";
rev = "v${version}";
hash = "sha256-dn1MrF+FYBG+vD5AfXCwmzskmKK/TXArnMWW2BAfFFQ=";
};
in
rustPlatform.buildRustPackage {
pname = "cargo-raze";
inherit src version;
sourceRoot = "${src.name}/impl";
# Make it build on Rust >1.76. Since upstream is unmaintained,
# there's no counting on them to fix this any time soon...
# See #310673 and #310125 for similar fixes
cargoPatches = [ ./rustc-serialize-fix.patch ];
cargoHash = "sha256-V8FkkWcXrYcDmhbdJztpbd4gBVbtbPY0NHS4pb/z8HM=";
nativeBuildInputs = [ pkg-config ];
buildInputs = [
libgit2
openssl
curl
] ++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security;
preCheck = lib.optionalString stdenv.isDarwin ''
# Darwin issue: Os { code: 24, kind: Uncategorized, message: "Too many open files" }
# https://github.com/google/cargo-raze/issues/544
ulimit -n 1024
'';
__darwinAllowLocalNetworking = true;
meta = {
description = "Generate Bazel BUILD files from Cargo dependencies";
homepage = "https://github.com/google/cargo-raze";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ elasticdog ];
};
}

View File

@ -0,0 +1,29 @@
diff --git a/impl/Cargo.lock b/impl/Cargo.lock
index 0c963206..7db3432f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1957,9 +1957,9 @@ dependencies = [
[[package]]
name = "rustc-serialize"
-version = "0.3.24"
+version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda"
+checksum = "fe834bc780604f4674073badbad26d7219cadfb4a2275802db12cbae17498401"
[[package]]
name = "ryu"
diff --git a/impl/Cargo.toml b/impl/Cargo.toml
index 9dd6dd99..a559febf 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -38,7 +38,7 @@ itertools = "0.10.0"
log = "0.4.13"
pathdiff = "0.2.0"
regex = "1.5.5"
-rustc-serialize = "0.3.24"
+rustc-serialize = "0.3.25"
semver = { version = "1", features = ["serde"] }
serde = "1.0.120"
serde_derive = "1.0.120"

View File

@ -1,48 +0,0 @@
{ lib
, stdenv
, fetchFromGitHub
, rustPlatform
, pkg-config
, curl
, libgit2
, openssl
, Security
}:
rustPlatform.buildRustPackage rec {
pname = "cargo-raze";
version = "0.16.0";
src = fetchFromGitHub {
owner = "google";
repo = pname;
rev = "v${version}";
hash = "sha256-ip0WuBn1b7uN/pAhOl5tfmToK73ZSHK7rucdtufsbCQ=";
};
sourceRoot = "${src.name}/impl";
cargoHash = "sha256-hNZgQwhm4UPqmANplZGxG0DYHa31tu06nmqYaCA7Vdg=";
nativeBuildInputs = [ pkg-config ];
buildInputs = [
libgit2
openssl
curl
]
++ lib.optional stdenv.isDarwin Security;
preCheck = lib.optionalString stdenv.isDarwin ''
# Darwin issue: Os { code: 24, kind: Uncategorized, message: "Too many open files" }
# https://github.com/google/cargo-raze/issues/544
ulimit -n 1024
'';
__darwinAllowLocalNetworking = true;
meta = with lib; {
description = "Generate Bazel BUILD files from Cargo dependencies";
homepage = "https://github.com/google/cargo-raze";
license = licenses.asl20;
maintainers = with maintainers; [ elasticdog ];
};
}

View File

@ -16737,9 +16737,6 @@ with pkgs;
cargo-nextest = callPackage ../development/tools/rust/cargo-nextest { };
cargo-play = callPackage ../development/tools/rust/cargo-play { };
cargo-raze = callPackage ../development/tools/rust/cargo-raze {
inherit (darwin.apple_sdk.frameworks) Security;
};
cargo-rdme = callPackage ../by-name/ca/cargo-rdme/package.nix {
inherit (darwin.apple_sdk.frameworks) Security;
};