diff --git a/pkgs/development/tools/rust/cargo-binstall/default.nix b/pkgs/development/tools/rust/cargo-binstall/default.nix new file mode 100644 index 000000000000..e38a1462cd9b --- /dev/null +++ b/pkgs/development/tools/rust/cargo-binstall/default.nix @@ -0,0 +1,64 @@ +{ lib +, rustPlatform +, fetchFromGitHub +, pkg-config +, bzip2 +, xz +, zstd +, stdenv +, darwin +}: + +rustPlatform.buildRustPackage rec { + pname = "cargo-binstall"; + version = "0.19.3"; + + src = fetchFromGitHub { + owner = "cargo-bins"; + repo = "cargo-binstall"; + rev = "v${version}"; + hash = "sha256-MxbZlUlan58TVgcr2n5ZA+L01u90bYYqf88GU+sLmKk="; + }; + + cargoHash = "sha256-HG43UCjPCB5bEH0GYPoHsOlaJQNPRrD175SuUJ6QbEI="; + + patches = [ + # make it possible to disable the static feature + # https://github.com/cargo-bins/cargo-binstall/pull/782 + ./fix-features.patch + ]; + + nativeBuildInputs = [ + pkg-config + ]; + + buildInputs = [ + bzip2 + xz + zstd + ] ++ lib.optionals stdenv.isDarwin [ + darwin.apple_sdk.frameworks.Security + ]; + + buildNoDefaultFeatures = true; + buildFeatures = [ + "fancy-no-backtrace" + "pkg-config" + "rustls" + "trust-dns" + "zstd-thin" + ]; + + # remove cargo config so it can find the linker on aarch64-unknown-linux-gnu + postPatch = '' + rm .cargo/config + ''; + + meta = with lib; { + description = "A tool for installing rust binaries as an alternative to building from source"; + homepage = "https://github.com/cargo-bins/cargo-binstall"; + changelog = "https://github.com/cargo-bins/cargo-binstall/releases/tag/v${version}"; + license = licenses.gpl3Only; + maintainers = with maintainers; [ figsoda ]; + }; +} diff --git a/pkgs/development/tools/rust/cargo-binstall/fix-features.patch b/pkgs/development/tools/rust/cargo-binstall/fix-features.patch new file mode 100644 index 000000000000..825dda604ae3 --- /dev/null +++ b/pkgs/development/tools/rust/cargo-binstall/fix-features.patch @@ -0,0 +1,22 @@ +--- a/crates/bin/Cargo.toml ++++ b/crates/bin/Cargo.toml +@@ -22,7 +22,7 @@ pkg-fmt = "zip" + pkg-fmt = "zip" + + [dependencies] +-binstalk = { path = "../binstalk", version = "0.7.1" } ++binstalk = { path = "../binstalk", version = "0.7.1", default-features = false } + binstalk-manifests = { path = "../binstalk-manifests", version = "0.2.0" } + clap = { version = "4.1.1", features = ["derive"] } + crates_io_api = { version = "0.8.1", default-features = false } +--- a/crates/binstalk/Cargo.toml ++++ b/crates/binstalk/Cargo.toml +@@ -11,7 +11,7 @@ license = "GPL-3.0" + + [dependencies] + async-trait = "0.1.61" +-binstalk-downloader = { version = "0.3.2", path = "../binstalk-downloader" } ++binstalk-downloader = { version = "0.3.2", path = "../binstalk-downloader", default-features = false } + binstalk-types = { version = "0.2.0", path = "../binstalk-types" } + cargo_toml = "0.14.0" + command-group = { version = "2.0.1", features = ["with-tokio"] } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3d3fb3c56467..363a3c78f948 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15698,6 +15698,7 @@ with pkgs; cargo-audit = callPackage ../development/tools/rust/cargo-audit { inherit (darwin.apple_sdk.frameworks) Security; }; + cargo-binstall = callPackage ../development/tools/rust/cargo-binstall { }; cargo-bisect-rustc = callPackage ../development/tools/rust/cargo-bisect-rustc { inherit (darwin.apple_sdk.frameworks) Security; };