1{
2 lib,
3 rustPlatform,
4 fetchFromGitLab,
5 gitMinimal,
6 installShellFiles,
7 makeWrapper,
8 nix-update-script,
9}:
10
11let
12 version = "2.11.0";
13
14 src = fetchFromGitLab {
15 owner = "pinage404";
16 repo = "git-gamble";
17 rev = "version/${version}";
18 hash = "sha256-b7jGrt8uJ9arH4EEsOOPCIcQmhwrrJb8uXcSsZPFrNQ=";
19 };
20in
21rustPlatform.buildRustPackage {
22 pname = "git-gamble";
23 inherit version src;
24
25 cargoHash = "sha256-lf66me4ot5lvrz2JTj8MreaHyVwOcFSVfPGX9lBTKug=";
26
27 nativeCheckInputs = [ gitMinimal ];
28 preCheck = ''
29 patchShebangs tests/editor/fake_editor.sh
30 '';
31 checkFlags = [
32 # this test can be flaky ; help is needed to stabilize it in upstream
33 "--skip=git_time_keeper::white_box::lock_file::create_as_many_as_lock_files_when_starting_several_times"
34 ];
35
36 nativeBuildInputs = [
37 installShellFiles
38 makeWrapper
39 ];
40 postInstall = ''
41 wrapProgram $out/bin/git-gamble \
42 --prefix PATH : "${lib.makeBinPath [ gitMinimal ]}"
43
44 export PATH="$PATH:$out/bin/"
45
46 sh ./script/generate_completion.sh target/release/shell_completions/
47 installShellCompletion --cmd git-gamble \
48 --bash target/release/shell_completions/git-gamble.bash \
49 --fish target/release/shell_completions/git-gamble.fish \
50 --zsh target/release/shell_completions/_git-gamble
51
52 sh ./script/usage.sh > git-gamble.1
53 installManPage git-gamble.1
54 '';
55
56 passthru.updateScript = nix-update-script { };
57
58 meta = {
59 description = "Tool that blends TDD (Test Driven Development) + TCR (`test && commit || revert`)";
60 homepage = "https://git-gamble.is-cool.dev";
61 changelog = "https://gitlab.com/pinage404/git-gamble/-/blob/${src.rev}/CHANGELOG.md";
62 license = lib.licenses.isc;
63 sourceProvenance = [ lib.sourceTypes.fromSource ];
64 maintainers = [ lib.maintainers.pinage404 ];
65 mainProgram = "git-gamble";
66 };
67}