1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 coreutils,
6 fswatch,
7 gitMinimal,
8 gnugrep,
9 gnused,
10 makeBinaryWrapper,
11 inotify-tools,
12 nix-update-script,
13}:
14
15stdenv.mkDerivation {
16 pname = "git-sync";
17 version = "0-unstable-2025-06-26";
18
19 src = fetchFromGitHub {
20 owner = "simonthum";
21 repo = "git-sync";
22 rev = "15af8a43cb4d8354f0b7e7c8d27e09587a9a3994";
23 hash = "sha256-7sCncPxVMiDGi1PSoFhA9emSY2Jit35/FaBbinCdS/A=";
24 };
25
26 nativeBuildInputs = [ makeBinaryWrapper ];
27
28 dontBuild = true;
29
30 installPhase =
31 let
32 wrapperPath = lib.makeBinPath (
33 [
34 coreutils
35 fswatch
36 gitMinimal
37 gnugrep
38 gnused
39 ]
40 ++ lib.optionals stdenv.hostPlatform.isLinux [ inotify-tools ]
41 );
42
43 in
44 ''
45 runHook preInstall
46
47 for file in git-*; do
48 install -D -m 755 "$file" -t $out/bin
49 done
50
51 for file in contrib/git-*; do
52 install -D -m 755 "$file" -t $out/bin
53 done
54
55 wrap_path="${wrapperPath}":$out/bin
56
57 for file in $out/bin/*; do
58 wrapProgram $file \
59 --prefix PATH : $wrap_path
60 done
61
62 runHook postInstall
63 '';
64
65 passthru = {
66 updateScript = nix-update-script { };
67 };
68
69 meta = {
70 description = "Script to automatically synchronize a git repository";
71 homepage = "https://github.com/simonthum/git-sync";
72 maintainers = with lib.maintainers; [ imalison ];
73 license = lib.licenses.cc0;
74 platforms = with lib.platforms; unix;
75 };
76}