1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 buildGoModule,
6 python3,
7}:
8
9buildGoModule rec {
10 pname = "cod";
11 version = "0.1.0";
12
13 src = fetchFromGitHub {
14 owner = "dim-an";
15 repo = "cod";
16 rev = "v${version}";
17 hash = "sha256-mT7OkR8fXXTE3TPx9AmH6ehKGLk4CP9euBPs2zVAJnI=";
18 };
19
20 vendorHash = "sha256-kezfBDTgpOTBYKTNlwuP+M5tXU2w/MXz0B5nBJcL1io=";
21
22 ldflags = [
23 "-s"
24 "-w"
25 "-X main.GitSha=${src.rev}"
26 ];
27
28 nativeCheckInputs = [ python3 ];
29
30 preCheck = ''
31 pushd test/binaries/
32 for f in *.py; do
33 patchShebangs ''$f
34 done
35 popd
36 export COD_TEST_BINARY="''${NIX_BUILD_TOP}/go/bin/cod"
37
38 substituteInPlace test/learn_test.go --replace TestLearnArgparseSubCommand SkipLearnArgparseSubCommand
39 '';
40
41 meta = with lib; {
42 description = "Tool for generating Bash/Fish/Zsh autocompletions based on `--help` output";
43 homepage = "https://github.com/dim-an/cod/";
44 license = licenses.asl20;
45 maintainers = with maintainers; [ SuperSandro2000 ];
46 broken = stdenv.hostPlatform.isDarwin;
47 mainProgram = "cod";
48 };
49}