mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-04 04:46:43 +00:00
6a9beaf893
This focuses on Rust packages, since the most commonly used argument parser library (clap/structopt) makes the following pattern natural and thus common: postInstall = '' installShellCompletion --cmd foo \ --bash <($out/bin/foo completion bash) \ … This commit just guards those with lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) splitting the string where unrelated actions are performed.
37 lines
1.1 KiB
Nix
37 lines
1.1 KiB
Nix
{ lib, rustPlatform, fetchFromGitHub, installShellFiles, stdenv }:
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "genact";
|
|
version = "1.4.2";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "svenstaro";
|
|
repo = pname;
|
|
rev = "v${version}";
|
|
sha256 = "sha256-Rn9kJWutWKPj9cLu2ZJKITmC+I8/ikhCAoIp00Yg6ZA=";
|
|
};
|
|
|
|
cargoHash = "sha256-kmXtwS5pCLEq5dbNHtWYGzDKjOUlVlr5xippVd2wl8k=";
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
|
$out/bin/genact --print-manpage > genact.1
|
|
installManPage genact.1
|
|
|
|
installShellCompletion --cmd genact \
|
|
--bash <($out/bin/genact --print-completions bash) \
|
|
--fish <($out/bin/genact --print-completions fish) \
|
|
--zsh <($out/bin/genact --print-completions zsh)
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Nonsense activity generator";
|
|
homepage = "https://github.com/svenstaro/genact";
|
|
changelog = "https://github.com/svenstaro/genact/blob/v${version}/CHANGELOG.md";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ figsoda ];
|
|
mainProgram = "genact";
|
|
};
|
|
}
|