diff --git a/pkgs/by-name/np/npins/package.nix b/pkgs/by-name/np/npins/package.nix index fde5c4268cb3..3d092fd4fe0b 100644 --- a/pkgs/by-name/np/npins/package.nix +++ b/pkgs/by-name/np/npins/package.nix @@ -1,8 +1,10 @@ { lib, + stdenv, rustPlatform, fetchFromGitHub, makeWrapper, + installShellFiles, # runtime dependencies nix-prefetch-git, @@ -19,25 +21,44 @@ let in rustPlatform.buildRustPackage (finalAttrs: { pname = "npins"; - version = "0.4.1"; + version = "0.5.0"; src = fetchFromGitHub { owner = "andir"; repo = "npins"; tag = finalAttrs.version; - sha256 = "sha256-XzJaDf5tlrYGTMJ+eS9hH9l79S4JA8h2KfbvKHF14xY="; + sha256 = "sha256-OkPEh0axWs3gUoUyplQexYpEXxyCDYWm5BQpwB2PIqA="; }; - cargoHash = "sha256-Fiku3UULsm6HL1skjJA/UiW9VRFRWbnXULQFBiVDCJ0="; + cargoHash = "sha256-ZbdAvt2FRq5fHS0RRndeCrpY3j8Lvn2oTAECteIss5A="; - nativeBuildInputs = [ makeWrapper ]; + cargoBuildFlags = [ + "-p" + "npins" + "-p" + "npins-completions" + ]; + + nativeBuildInputs = [ + makeWrapper + installShellFiles + ]; # (Almost) all tests require internet doCheck = false; - postFixup = '' - wrapProgram $out/bin/npins --prefix PATH : "${runtimePath}" - ''; + postFixup = + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + installShellCompletion --cmd npins \ + --bash <($out/bin/npins-completions bash) \ + --fish <(cat <($out/bin/npins-completions fish) $src/completions/pin-completions.fish) \ + --zsh <($out/bin/npins-completions zsh) + + rm $out/bin/npins-completions + '' + + '' + wrapProgram $out/bin/npins --prefix PATH : "${runtimePath}" + ''; meta = { description = "Simple and convenient dependency pinning for Nix";