diff --git a/pkgs/by-name/ca/cargo-raze/package.nix b/pkgs/by-name/ca/cargo-raze/package.nix new file mode 100644 index 000000000000..a0b4fd0ace7b --- /dev/null +++ b/pkgs/by-name/ca/cargo-raze/package.nix @@ -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 ]; + }; +} diff --git a/pkgs/by-name/ca/cargo-raze/rustc-serialize-fix.patch b/pkgs/by-name/ca/cargo-raze/rustc-serialize-fix.patch new file mode 100644 index 000000000000..4c34cbeecb94 --- /dev/null +++ b/pkgs/by-name/ca/cargo-raze/rustc-serialize-fix.patch @@ -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" diff --git a/pkgs/development/tools/rust/cargo-raze/default.nix b/pkgs/development/tools/rust/cargo-raze/default.nix deleted file mode 100644 index b87d9d4570b6..000000000000 --- a/pkgs/development/tools/rust/cargo-raze/default.nix +++ /dev/null @@ -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 ]; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6aab5726b385..7fed63406580 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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; };