about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/version-management/git-and-tools/gst/default.nix
blob: a323c61bf143dc729c83d3b70e09ea790990fd2f (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
55
56
{ lib
, buildGoModule
, fetchFromGitHub
, git
, ghq
}:

buildGoModule rec {
  pname = "gst";
  version = "5.0.4";

  src = fetchFromGitHub {
    owner = "uetchy";
    repo = "gst";
    rev = "v${version}";
    sha256 = "0fqgkmhn84402hidxv4niy9himcdwm1h80prkfk9vghwcyynrbsj";
  };

  vendorSha256 = "0k5xl55vzpl64gwsgaff92jismpx6y7l2ia0kx7gamd1vklf0qwh";

  doCheck = false;

  nativeBuildInputs = [
    git
    ghq
  ];

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

  doInstallCheck = true;
  installCheckPhase = ''
    if [[ "$("$out/bin/${pname}" --version)" == "${pname} version ${version}" ]]; then
      export HOME=$(mktemp -d)
      git config --global user.name "Test User"
      git config --global user.email "test@example.com"
      git config --global init.defaultBranch "main"
      git config --global ghq.user "user"
      ghq create test > /dev/null 2>&1
      touch $HOME/ghq/github.com/user/test/SmokeTest
      $out/bin/${pname} list | grep SmokeTest > /dev/null
      echo '${pname} smoke check passed'
    else
      echo '${pname} smoke check failed'
      return 1
    fi
  '';

  meta = {
    description = "Supercharge your ghq workflow";
    homepage = "https://github.com/uetchy/gst";
    maintainers = with lib.maintainers; [ _0x4A6F ];
    license = lib.licenses.asl20;
  };
}