mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-15 14:26:33 +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.
56 lines
1.3 KiB
Nix
56 lines
1.3 KiB
Nix
{
|
|
darwin,
|
|
fetchFromGitea,
|
|
installShellFiles,
|
|
lib,
|
|
openssl,
|
|
pkg-config,
|
|
rustPlatform,
|
|
stdenv,
|
|
}:
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "codeberg-cli";
|
|
version = "0.4.2";
|
|
|
|
src = fetchFromGitea {
|
|
domain = "codeberg.org";
|
|
owner = "Aviac";
|
|
repo = "codeberg-cli";
|
|
rev = "v${version}";
|
|
hash = "sha256-SUKV7tH7tvSPtlMcRlOgjvAEqPoBi4J41Ak5k4h4Qj0=";
|
|
};
|
|
|
|
cargoHash = "sha256-FlW0Q2UUt6AX/A0MznGpJY8+yoMs70N58Ow05ly9YyE=";
|
|
nativeBuildInputs = [
|
|
pkg-config
|
|
installShellFiles
|
|
];
|
|
|
|
buildInputs =
|
|
[ openssl ]
|
|
++ lib.optionals stdenv.isDarwin (
|
|
let
|
|
d = darwin.apple_sdk.frameworks;
|
|
in
|
|
[
|
|
d.CoreServices
|
|
d.Security
|
|
d.SystemConfiguration
|
|
]
|
|
);
|
|
|
|
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
|
installShellCompletion --cmd berg \
|
|
--bash <($out/bin/berg completion bash) \
|
|
--fish <($out/bin/berg completion fish) \
|
|
--zsh <($out/bin/berg completion zsh)
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "CLI Tool for Codeberg similar to gh and glab";
|
|
homepage = "https://codeberg.org/Aviac/codeberg-cli";
|
|
license = with licenses; [ agpl3Plus ];
|
|
maintainers = with maintainers; [ robwalt ];
|
|
mainProgram = "berg";
|
|
};
|
|
}
|