mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-15 06:14:57 +01: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.
46 lines
1.3 KiB
Nix
46 lines
1.3 KiB
Nix
{ lib
|
|
, stdenv
|
|
, fetchFromGitHub
|
|
, rustPlatform
|
|
, installShellFiles
|
|
, pkg-config
|
|
, perl
|
|
, openssl
|
|
}:
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "release-plz";
|
|
version = "0.3.79";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "MarcoIeni";
|
|
repo = "release-plz";
|
|
rev = "release-plz-v${version}";
|
|
hash = "sha256-tI9/FtGxjKPIFg6L7pNeSx24G3FcfwOlIqcuF6wCTSU=";
|
|
};
|
|
|
|
cargoHash = "sha256-UN3SkNNY8ovaT/eNb9JyF9KQWt8KG0TX9ztLjrAnPPo=";
|
|
|
|
nativeBuildInputs = [ installShellFiles pkg-config perl ];
|
|
buildInputs = [ openssl ];
|
|
|
|
buildAndTestSubdir = "crates/release_plz";
|
|
|
|
# Tests depend on additional infrastructure to be running locally
|
|
doCheck = false;
|
|
|
|
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
|
installShellCompletion --cmd ${meta.mainProgram} \
|
|
--bash <($out/bin/${meta.mainProgram} generate-completions bash) \
|
|
--fish <($out/bin/${meta.mainProgram} generate-completions fish) \
|
|
--zsh <($out/bin/${meta.mainProgram} generate-completions zsh)
|
|
'';
|
|
|
|
meta = {
|
|
description = "Publish Rust crates from CI with a Release PR";
|
|
homepage = "https://release-plz.ieni.dev";
|
|
license = with lib.licenses; [ asl20 mit ];
|
|
maintainers = with lib.maintainers; [ dannixon ];
|
|
mainProgram = "release-plz";
|
|
broken = stdenv.isDarwin;
|
|
};
|
|
}
|