-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdefault.nix
83 lines (73 loc) · 2.02 KB
/
default.nix
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{ lib
, buildGoModule
, nix-gitignore
, installShellFiles
, makeWrapper
, bash
, coreutils
, git
, pandoc
, commit ? null
, doCheck ? false
}:
let
pname = "gg-scm";
version = "2.0.0";
in buildGoModule {
inherit pname version;
src = let
root = ./.;
patterns = nix-gitignore.withGitignoreFile extraIgnores root;
extraIgnores = [ ".github" ".vscode" "*.nix" "flake.lock" ];
in builtins.path {
name = "${pname}-source";
path = root;
filter = nix-gitignore.gitignoreFilterPure (_: _: true) patterns root;
};
postPatch = ''
substituteInPlace cmd/gg/editor_unix.go \
--replace /bin/sh ${bash}/bin/sh
'';
subPackages = [ "cmd/gg" ];
ldflags = [
"-s" "-w"
"-X" "main.versionInfo=${version}"
] ++ lib.lists.optional (!builtins.isNull commit) [
"-X" "main.buildCommit=${commit}"
];
vendorHash = "sha256-iWGO5Hh5bMS/DsCKham7T+V9Tyib0Py9oQlQzQytUWk=";
nativeBuildInputs = [ pandoc installShellFiles makeWrapper ];
nativeCheckInputs = [ bash coreutils git ];
buildInputs = [ bash git ];
postBuild = ''
pandoc --standalone --to man misc/gg.1.md -o misc/gg.1
'';
inherit doCheck;
checkFlags = [ "-race" ];
checkPhase = ''
runHook preCheck
export GOFLAGS=''${GOFLAGS//-trimpath/}
buildGoDir test ./...
runHook postCheck
'';
postInstall = ''
wrapProgram $out/bin/gg --suffix PATH : ${git}/bin
installManPage misc/gg.1
installShellCompletion --cmd gg \
--bash misc/gg.bash \
--zsh misc/_gg.zsh
'';
meta = with lib; {
mainProgram = "gg";
description = "Git with less typing";
longDescription = ''
gg is an alternative command-line interface for Git heavily inspired by Mercurial.
It's designed for less typing in common workflows,
making Git easier to use for both novices and advanced users alike.
'';
homepage = "https://gg-scm.io/";
changelog = "https://github.com/gg-scm/gg/blob/v${version}/CHANGELOG.md";
license = licenses.asl20;
maintainers = with maintainers; [ zombiezen ];
};
}