nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 replaceVars,
6 installShellFiles,
7 testers,
8 org-stats,
9}:
10
11buildGoModule rec {
12 pname = "org-stats";
13 version = "1.12.2";
14
15 src = fetchFromGitHub {
16 owner = "caarlos0";
17 repo = "org-stats";
18 rev = "v${version}";
19 hash = "sha256-QTjJ+4Qu5u+5ZCoIAQBxqdhjNI2CXUB8r2Zx8xfIiGw=";
20 };
21
22 vendorHash = "sha256-0biuv94wGXiME181nlkvozhB+x4waGMgwXD9ColQWPw=";
23
24 patches = [
25 # patch in version information
26 # since `debug.ReadBuildInfo` does not work with `go build
27 (replaceVars ./version.patch {
28 inherit version;
29 })
30 ];
31
32 nativeBuildInputs = [
33 installShellFiles
34 ];
35
36 ldflags = [
37 "-s"
38 "-w"
39 ];
40
41 postInstall = ''
42 $out/bin/org-stats man > org-stats.1
43 installManPage org-stats.1
44
45 installShellCompletion --cmd org-stats \
46 --bash <($out/bin/org-stats completion bash) \
47 --fish <($out/bin/org-stats completion fish) \
48 --zsh <($out/bin/org-stats completion zsh)
49 '';
50
51 passthru.tests = {
52 version = testers.testVersion {
53 package = org-stats;
54 command = "org-stats version";
55 };
56 };
57
58 meta = with lib; {
59 description = "Get the contributor stats summary from all repos of any given organization";
60 homepage = "https://github.com/caarlos0/org-stats";
61 changelog = "https://github.com/caarlos0/org-stats/releases/tag/${src.rev}";
62 license = licenses.mit;
63 maintainers = with maintainers; [ figsoda ];
64 mainProgram = "org-stats";
65 };
66}