about summary refs log tree commit diff
path: root/nixpkgs/pkgs/games/gambit/default.nix
blob: 4bcd329171cc801bc3390e297c7d5612124bf601 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{ lib
, buildGoModule
, fetchFromGitHub
, installShellFiles
, testers
, gambit-chess
}:

buildGoModule rec {
  pname = "gambit";
  version = "0.1.0";

  src = fetchFromGitHub {
    owner = "maaslalani";
    repo = "gambit";
    rev = "v${version}";
    hash = "sha256-RLbD9JK1yJn30WWg7KWDjJoj4WXIoy3Kb8t2F8rFPuk=";
  };

  vendorHash = "sha256-d9fPlv+ZAzQA42I61B5JEzfYpfJc9vWBcLYTX/s5dhs=";

  nativeBuildInputs = [
    installShellFiles
  ];

  ldflags = [
    "-s"
    "-w"
    "-X=main.Version=v${version}"
    "-X=main.CommitSHA=${src.rev}"
  ];

  postInstall = ''
    installShellCompletion --cmd gambit \
      --bash <($out/bin/gambit completion bash) \
      --fish <($out/bin/gambit completion fish) \
      --zsh <($out/bin/gambit completion zsh)
  '';

  passthru.tests = {
    version = testers.testVersion {
      package = gambit-chess;
      version = "v${version}";
    };
  };

  meta = with lib; {
    description = "Play chess in your terminal";
    homepage = "https://github.com/maaslalani/gambit";
    changelog = "https://github.com/maaslalani/gambit/releases/tag/${src.rev}";
    license = licenses.mit;
    maintainers = with maintainers; [ figsoda ];
  };
}