{ lib, stdenv, rustPlatform, fetchFromGitHub, installShellFiles, nix-update-script, usage, testers, }: rustPlatform.buildRustPackage (finalAttrs: { pname = "usage"; version = "2.1.1"; src = fetchFromGitHub { owner = "jdx"; repo = "usage"; tag = "v${finalAttrs.version}"; hash = "sha256-aMO/3geF1iFnMi0ZqBdnikp/Qh25vqpeaxdTiQtt5yI="; }; cargoHash = "sha256-0NQZtT3xz4MaqY8ehKzy/cpDJlE5eWIixi3IropK11w="; postPatch = '' substituteInPlace ./examples/mounted.sh \ --replace-fail '/usr/bin/env -S usage' "$(pwd)/target/${stdenv.targetPlatform.rust.rustcTargetSpec}/release/usage" ''; nativeBuildInputs = [ installShellFiles ]; postInstall = '' installShellCompletion --cmd usage \ --bash <($out/bin/usage --completions bash) \ --fish <($out/bin/usage --completions fish) \ --zsh <($out/bin/usage --completions zsh) ''; passthru = { updateScript = nix-update-script { }; tests.version = testers.testVersion { package = usage; }; }; meta = { homepage = "https://usage.jdx.dev"; description = "Specification for CLIs"; changelog = "https://github.com/jdx/usage/releases/tag/v${finalAttrs.version}"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ konradmalik ]; mainProgram = "usage"; }; })