1{
2 lib,
3 stdenv,
4 buildPackages,
5 fetchFromGitHub,
6 rustPlatform,
7 git,
8 nix-update-script,
9 installShellFiles,
10}:
11let
12 emulatorAvailable = stdenv.hostPlatform.emulatorAvailable buildPackages;
13 emulator = stdenv.hostPlatform.emulator buildPackages;
14 version = "0.5.3";
15in
16rustPlatform.buildRustPackage {
17 pname = "git-prole";
18 inherit version;
19
20 src = fetchFromGitHub {
21 owner = "9999years";
22 repo = "git-prole";
23 tag = "v${version}";
24 hash = "sha256-QwLkByC8gdAnt6geZS285ErdH8nfV3vsWjMF4hTzq9Y=";
25 };
26
27 buildFeatures = [ "clap_mangen" ];
28
29 cargoHash = "sha256-qghc8HtJfpTYXAwC2xjq8lLlCu419Ttnu/AYapkAulI=";
30
31 nativeCheckInputs = [
32 git
33 ];
34
35 nativeBuildInputs = [
36 installShellFiles
37 ];
38
39 postInstall = lib.optionalString emulatorAvailable ''
40 manpages=$(mktemp -d)
41 ${emulator} $out/bin/git-prole manpages "$manpages"
42 for manpage in "$manpages"/*; do
43 installManPage "$manpage"
44 done
45
46 installShellCompletion --cmd git-prole \
47 --bash <(${emulator} $out/bin/git-prole completions bash) \
48 --fish <(${emulator} $out/bin/git-prole completions fish) \
49 --zsh <(${emulator} $out/bin/git-prole completions zsh)
50 '';
51
52 meta = {
53 homepage = "https://github.com/9999years/git-prole";
54 changelog = "https://github.com/9999years/git-prole/releases/tag/v${version}";
55 description = "`git-worktree(1)` manager";
56 license = [ lib.licenses.mit ];
57 maintainers = [ lib.maintainers._9999years ];
58 mainProgram = "git-prole";
59 };
60
61 passthru.updateScript = nix-update-script { };
62}