nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 gitMinimal,
6 ghq,
7}:
8
9buildGoModule rec {
10 pname = "gst";
11 version = "5.0.5";
12
13 src = fetchFromGitHub {
14 owner = "uetchy";
15 repo = "gst";
16 rev = "v${version}";
17 hash = "sha256-NhbGHTYucfqCloVirkaDlAtQfhWP2cw4I+t/ysvvkR0=";
18 };
19
20 vendorHash = "sha256-kGPg6NyhVfVOn0BFQY83/VYdpUjOqaf5I4bev0uhvUw=";
21
22 doCheck = false;
23
24 nativeBuildInputs = [
25 gitMinimal
26 ghq
27 ];
28
29 ldflags = [
30 "-s"
31 "-w"
32 "-X=main.Version=${version}"
33 ];
34
35 doInstallCheck = true;
36 installCheckPhase = ''
37 if [[ "$("$out/bin/${pname}" --version)" == "${pname} version ${version}" ]]; then
38 export HOME=$(mktemp -d)
39 git config --global user.name "Test User"
40 git config --global user.email "test@example.com"
41 git config --global init.defaultBranch "main"
42 git config --global ghq.user "user"
43 ghq create test > /dev/null 2>&1
44 touch $HOME/ghq/github.com/user/test/SmokeTest
45 $out/bin/${pname} list | grep SmokeTest > /dev/null
46 echo '${pname} smoke check passed'
47 else
48 echo '${pname} smoke check failed'
49 return 1
50 fi
51 '';
52
53 meta = {
54 description = "Supercharge your ghq workflow";
55 homepage = "https://github.com/uetchy/gst";
56 maintainers = with lib.maintainers; [ _0x4A6F ];
57 license = lib.licenses.asl20;
58 mainProgram = "gst";
59 };
60}