1{
2 lib,
3 stdenv,
4 buildGo124Module,
5 fetchFromGitHub,
6 git,
7 nix-update-script,
8 installShellFiles,
9}:
10
11buildGo124Module rec {
12 pname = "git-spice";
13 version = "0.15.2";
14
15 src = fetchFromGitHub {
16 owner = "abhinav";
17 repo = "git-spice";
18 tag = "v${version}";
19 hash = "sha256-vpBQdkP5jC3glGykLCd3/df4Lhi0MeU0XLnlTNDp1bM=";
20 };
21
22 vendorHash = "sha256-uh4GUkfWo12pYQD/Mpw+EWwmukHUpxOii7DTu6C84zo=";
23
24 subPackages = [ "." ];
25
26 nativeBuildInputs = [ installShellFiles ];
27
28 nativeCheckInputs = [ git ];
29
30 buildInputs = [ git ];
31
32 ldflags = [
33 "-s"
34 "-w"
35 "-X=main._version=${version}"
36 ];
37
38 __darwinAllowLocalNetworking = true;
39
40 preCheck = ''
41 # timeout on both aarch64-darwin and x86_64-linux
42 rm testdata/script/issue725_pre_push_hook_worktree.txt
43
44 # failing on both aarch64-darwin and x86_64-linux
45 # TODO: check if this still fails after next release
46 rm testdata/script/branch_restack_conflict_no_edit.txt
47 ''
48
49 + lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) ''
50 # timeout
51 rm testdata/script/branch_submit_remote_prompt.txt
52 rm testdata/script/branch_submit_multiple_pr_templates.txt
53 '';
54
55 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
56 installShellCompletion --cmd gs \
57 --bash <($out/bin/gs shell completion bash) \
58 --zsh <($out/bin/gs shell completion zsh) \
59 --fish <($out/bin/gs shell completion fish)
60 '';
61
62 passthru.updateScript = nix-update-script { };
63
64 meta = {
65 description = "Manage stacked Git branches";
66 homepage = "https://abhinav.github.io/git-spice/";
67 changelog = "https://github.com/abhinav/git-spice/blob/${src.rev}/CHANGELOG.md";
68 license = lib.licenses.gpl3Only;
69 maintainers = [ lib.maintainers.vinnymeller ];
70 mainProgram = "gs";
71 };
72}