diff --git a/pkgs/build-support/rust/fetchcrate.nix b/pkgs/build-support/rust/fetchcrate.nix index 95dfd38b12ae..4e6c38b032ce 100644 --- a/pkgs/build-support/rust/fetchcrate.nix +++ b/pkgs/build-support/rust/fetchcrate.nix @@ -1,10 +1,13 @@ { lib, fetchurl, unzip }: -{ crateName +{ crateName ? args.pname +, pname ? null , version , sha256 , ... } @ args: +assert pname == null || pname == crateName; + lib.overrideDerivation (fetchurl ({ name = "${crateName}-${version}.tar.gz"; @@ -30,6 +33,6 @@ lib.overrideDerivation (fetchurl ({ fi mv "$unpackDir/$fn" "$out" ''; -} // removeAttrs args [ "crateName" "version" ])) +} // removeAttrs args [ "crateName" "pname" "version" ])) # Hackety-hack: we actually need unzip hooks, too (x: {nativeBuildInputs = x.nativeBuildInputs++ [unzip];}) diff --git a/pkgs/tools/misc/broot/default.nix b/pkgs/tools/misc/broot/default.nix index 8e0c71e08d71..7387270b7379 100644 --- a/pkgs/tools/misc/broot/default.nix +++ b/pkgs/tools/misc/broot/default.nix @@ -1,6 +1,6 @@ { stdenv , rustPlatform -, fetchFromGitHub +, fetchCrate , installShellFiles , makeWrapper , coreutils @@ -12,11 +12,9 @@ rustPlatform.buildRustPackage rec { pname = "broot"; version = "0.20.3"; - src = fetchFromGitHub { - owner = "Canop"; - repo = pname; - rev = "v${version}"; - sha256 = "0hbz7cslngl77qka8sl84fjhijbqbw69dj058ghhsgaxw06nypg2"; + src = fetchCrate { + inherit pname version; + sha256 = "0vw956c5xpjsbd9b0ardvgi9jjqb230m2x5n4h9ai0yiwizc8rh6"; }; cargoSha256 = "1zl4p3n327iq7nm7hi79zjxv2gvw9f3lwgkg1qp52kycv1af5gqp";