mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 01:13:05 +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.
40 lines
1.1 KiB
Nix
40 lines
1.1 KiB
Nix
{
|
|
lib,
|
|
rustPlatform,
|
|
fetchFromGitHub,
|
|
installShellFiles,
|
|
stdenv,
|
|
}: let
|
|
version = "0.15.2";
|
|
in
|
|
rustPlatform.buildRustPackage {
|
|
pname = "pace";
|
|
inherit version;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "pace-rs";
|
|
repo = "pace";
|
|
rev = "refs/tags/pace-rs-v${version}";
|
|
hash = "sha256-gyyf4GGHIEdiAWvzKbaOApFikoh3RLWBCZUfJ0MjbIE=";
|
|
};
|
|
|
|
cargoHash = "sha256-D7jxju2R0S5wAsK7Gd8W32t/KKFaDjLHNZ2X/OEuPtk=";
|
|
|
|
nativeBuildInputs = [installShellFiles];
|
|
|
|
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
|
installShellCompletion --cmd pace \
|
|
--bash <($out/bin/pace setup completions bash) \
|
|
--fish <($out/bin/pace setup completions fish) \
|
|
--zsh <($out/bin/pace setup completions zsh)
|
|
'';
|
|
|
|
meta = {
|
|
description = "Command-line program for mindful time tracking";
|
|
homepage = "https://github.com/pace-rs/pace";
|
|
license = lib.licenses.agpl3Only;
|
|
maintainers = with lib.maintainers; [isabelroses];
|
|
mainProgram = "pace";
|
|
};
|
|
}
|