depot/pkgs/by-name/jc/jcli/package.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

50 lines
1.2 KiB
Nix

{
lib,
stdenv,
buildGoModule,
fetchFromGitHub,
installShellFiles,
}:
buildGoModule rec {
pname = "jcli";
version = "0.0.42";
src = fetchFromGitHub {
owner = "jenkins-zh";
repo = "jenkins-cli";
rev = "v${version}";
hash = "sha256-t9NE911TjAvoCsmf9F989DNQ+s9GhgUF7cwuyHefWts=";
};
vendorHash = "sha256-bmPnxFvdKU5zuMsCDboSOxP5f7NnMRwS/gN0sW7eTRA=";
ldflags = [
"-s"
"-w"
"-X github.com/linuxsuren/cobra-extension/version.version=${version}"
];
doCheck = false;
nativeBuildInputs = [ installShellFiles ];
postInstall =
''
mv $out/bin/{jenkins-cli,jcli}
''
+ lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd jcli \
--bash <($out/bin/jcli completion --type bash) \
--zsh <($out/bin/jcli completion --type zsh)
'';
meta = {
description = "Jenkins CLI allows you to manage your Jenkins in an easy way";
mainProgram = "jcli";
homepage = "https://github.com/jenkins-zh/jenkins-cli";
changelog = "https://github.com/jenkins-zh/jenkins-cli/releases/tag/${src.rev}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ sikmir ];
};
}