mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-01 19:33:03 +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.
36 lines
1.2 KiB
Nix
36 lines
1.2 KiB
Nix
{ lib, stdenv, fetchFromGitHub, rustPlatform, libiconv, installShellFiles }:
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "flavours";
|
|
version = "0.7.1";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "Misterio77";
|
|
repo = pname;
|
|
rev = "v${version}";
|
|
hash = "sha256-SOsHvcfDdUpb0x5VZ1vZJnGaIiWWOPgnAwKYNXzfUfI=";
|
|
};
|
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
|
|
|
|
cargoHash = "sha256-aimPeGIE5jP0pdrqwnzUzBqW0jz9+kcfpLdCN0r30xU=";
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
|
installShellCompletion --cmd flavours \
|
|
--zsh <($out/bin/flavours --completions zsh) \
|
|
--fish <($out/bin/flavours --completions fish) \
|
|
--bash <($out/bin/flavours --completions bash)
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Easy to use base16 scheme manager/builder that integrates with any workflow";
|
|
homepage = "https://github.com/Misterio77/flavours";
|
|
changelog = "https://github.com/Misterio77/flavours/releases/tag/v${version}";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ moni misterio77 ];
|
|
mainProgram = "flavours";
|
|
};
|
|
}
|