nixpkgs/pkgs/by-name/pu/pulsarctl/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

75 lines
1.7 KiB
Nix

{ lib
, buildGoModule
, fetchFromGitHub
, installShellFiles
, nix-update-script
, go
, testers
, pulsarctl
}:
buildGoModule rec {
pname = "pulsarctl";
version = "2.11.1.3";
src = fetchFromGitHub {
owner = "streamnative";
repo = "pulsarctl";
rev = "v${version}";
hash = "sha256-sztjHw3su8KAV/zZcJqPWhjblINa8nYCN5Dzhn6X07w=";
};
vendorHash = "sha256-NQ8zvrW6lBF1js+WI2PPvXhv4YRS2IBT6S4vDoE1BFc=";
nativeBuildInputs = [ installShellFiles ];
ldflags =
let
buildVars = {
ReleaseVersion = version;
BuildTS = "None";
GitHash = src.rev;
GitBranch = "None";
GoVersion = "go${go.version}";
};
in
(lib.mapAttrsToList (k: v: "-X github.com/streamnative/pulsarctl/pkg/cmdutils.${k}=${v}") buildVars);
excludedPackages = [
"./pkg/test"
"./pkg/test/bookkeeper"
"./pkg/test/bookkeeper/containers"
"./pkg/test/pulsar"
"./pkg/test/pulsar/containers"
"./site/gen-pulsarctldocs"
"./site/gen-pulsarctldocs/generators"
];
doCheck = false;
postInstall = ''
installShellCompletion --cmd pulsarctl \
--bash <($out/bin/pulsarctl completion bash) \
--fish <($out/bin/pulsarctl completion fish) \
--zsh <($out/bin/pulsarctl completion zsh)
'';
passthru = {
updateScript = nix-update-script { };
tests.version = testers.testVersion {
package = pulsarctl;
command = "pulsarctl --version";
version = "v${version}";
};
};
meta = with lib; {
description = " a CLI for Apache Pulsar written in Go";
homepage = "https://github.com/streamnative/pulsarctl";
license = with licenses; [ asl20 ];
platforms = platforms.unix;
maintainers = with maintainers; [ gaelreyrol ];
mainProgram = "pulsarctl";
};
}