diff --git a/pkgs/by-name/us/usage/package.nix b/pkgs/by-name/us/usage/package.nix index fc64c2bd80d8..58e6a1183629 100644 --- a/pkgs/by-name/us/usage/package.nix +++ b/pkgs/by-name/us/usage/package.nix @@ -12,16 +12,20 @@ rustPlatform.buildRustPackage (finalAttrs: { pname = "usage"; - version = "3.0.0"; + version = "3.2.0"; src = fetchFromGitHub { owner = "jdx"; repo = "usage"; tag = "v${finalAttrs.version}"; - hash = "sha256-KC3fIfFnXn5K1E1CyHLADaEesXFilCrIe9MYOH/fkrI="; + hash = "sha256-0yonwl/2BIkGUs0uOBP+Pjo93NvLVK4QQQj/K4C4NNY="; }; - cargoHash = "sha256-RNeHa3V4oCvtiR6/ntTegKl62ByWZbFeliFJVgsHYrQ="; + cargoHash = "sha256-jxTN+La7Ye2okRZGAY6niIvvRf2E4vFFHd1nny7JJDo="; + + patches = [ + ./use-bin-exe-env.patch + ]; postPatch = '' substituteInPlace ./examples/*.sh \ diff --git a/pkgs/by-name/us/usage/use-bin-exe-env.patch b/pkgs/by-name/us/usage/use-bin-exe-env.patch new file mode 100644 index 000000000000..832881faeb85 --- /dev/null +++ b/pkgs/by-name/us/usage/use-bin-exe-env.patch @@ -0,0 +1,17 @@ +diff --git a/cli/tests/shell_completions_integration.rs b/cli/tests/shell_completions_integration.rs +index 815c44c..51b5dd9 100644 +--- a/cli/tests/shell_completions_integration.rs ++++ b/cli/tests/shell_completions_integration.rs +@@ -25,6 +25,13 @@ fn run_complete_word(usage_bin: &Path, shell: &str, spec_file: &Path, words: &[& + + /// Build the usage binary and return its path + fn build_usage_binary() -> PathBuf { ++ if let Some(usage_path) = std::env::var("CARGO_BIN_EXE_usage") ++ .ok() ++ .filter(|s| !s.is_empty()) ++ { ++ return PathBuf::from(usage_path); ++ } ++ + let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + let workspace_root = manifest_dir.parent().unwrap();