1{
2 lib,
3 rustPlatform,
4 fetchFromGitHub,
5 stdenv,
6 git,
7}:
8
9rustPlatform.buildRustPackage {
10 pname = "git-wait";
11 version = "0.4.0-unstable-2024-12-01";
12
13 src = fetchFromGitHub {
14 owner = "darshanparajuli";
15 repo = "git-wait";
16 # no tags upstream
17 rev = "1d610f694dd1cd4a0970e97b886053ffc7c76244";
18 hash = "sha256-Va917eD9M3oUVmLrDab6cx/LvmBlk95U4mRHqPpBB5I=";
19 };
20
21 cargoHash = "sha256-tA0WjghBB2K71IlZ1u9K67tZWGe9VNFOfI2YdrqCUw0=";
22
23 checkFlags = lib.optionals stdenv.hostPlatform.isDarwin [
24 "--skip=tests::wait_if_index_lock_is_present"
25 ];
26
27 # versionCheckHook is too complex to use here
28 doInstallCheck = true;
29 nativeInstallCheckInputs = [ git ];
30 installCheckPhase = ''
31 runHook preInstallCheck
32
33 stdout=$(set -x; $out/bin/git-wait -v 2>&1)
34 if ! grep <<<"$stdout" -q ${lib.escapeShellArg git.version}; then
35 >&2 echo "ERROR: version check failed!" ${lib.escapeShellArg git.version} "was not found."
36 >&2 echo "Output was"
37 >&2 echo "$stdout"
38 fi
39
40 runHook postInstallCheck
41 '';
42
43 meta = {
44 description = "Simple git wrapper that waits until index.lock file is removed when present before running the command";
45 homepage = "https://github.com/darshanparajuli/git-wait";
46 license = lib.licenses.mit;
47 maintainers = with lib.maintainers; [ pbsds ];
48 mainProgram = "git-wait";
49 };
50}