nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 testers,
6 cog,
7 stdenv,
8}:
9
10buildGoModule rec {
11 pname = "cog";
12 version = "0.0.47";
13
14 src = fetchFromGitHub {
15 owner = "grafana";
16 repo = "cog";
17 tag = "v${version}";
18 hash = "sha256-gbM/PknM8ZC4BJx2OymLSuQO+DndB3f1Wx0zvep9tn0=";
19 };
20
21 vendorHash = "sha256-Uf6XwwhWl6dzJJFeDgIoQU0zZ2QFjzEWwv+q9YazTxs=";
22
23 subPackages = [ "cmd/cli" ];
24
25 ldflags = [
26 "-s"
27 "-w"
28 "-X=main.version=${version}"
29 ];
30
31 env.CGO_ENABLED = 0;
32
33 passthru.tests.version = testers.testVersion { package = cog; };
34
35 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
36 mv $out/bin/cli $out/bin/cog
37 '';
38
39 meta = {
40 changelog = "https://github.com/grafana/cog/releases/tag/v${version}";
41 description = "Grafana's code generation tool";
42 license = lib.licenses.asl20;
43 homepage = "https://github.com/grafana/cog";
44 maintainers = [
45 lib.maintainers.zebradil
46 ];
47 mainProgram = "cog";
48 };
49}