nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 versionCheckHook,
6 nix-update-script,
7}:
8
9buildGoModule (finalAttrs: {
10 pname = "grafanactl";
11 version = "0.1.1";
12
13 src = fetchFromGitHub {
14 owner = "grafana";
15 repo = "grafanactl";
16 tag = "v${finalAttrs.version}";
17 hash = "sha256-l+Aj1n0ZU7tW5hTKeTkZQgvlnOBISaYJ2qFramD4eiY=";
18 };
19
20 vendorHash = "sha256-eEgGrb/un+KkT7DBJ1SMUUHauZQMYroKo6OBrgzGicM=";
21
22 ldflags = [
23 "-X main.version=v${finalAttrs.version}"
24 "-X main.commit=unknown"
25 "-X main.date=unknown"
26 ];
27
28 subPackage = [ "cmd/grafanactl" ];
29
30 postInstall = ''
31 rm $out/bin/cmd-reference
32 rm $out/bin/config-reference
33 rm $out/bin/env-vars-reference
34 '';
35
36 doInstallCheck = true;
37 nativeInstallCheckInputs = [
38 versionCheckHook
39 ];
40 versionCheckProgramArg = "--version";
41
42 passthru.updateScript = nix-update-script { };
43
44 meta = {
45 description = "Tool designed to simplify interaction with Grafana instances";
46 homepage = "https://github.com/grafana/grafanactl";
47 changelog = "https://github.com/grafana/grafanactl/tags/v${finalAttrs.version}";
48 license = lib.licenses.asl20;
49 maintainers = with lib.maintainers; [ wcarlsen ];
50 mainProgram = "grafanactl";
51 };
52})