1{ lib, stdenv, fetchFromGitHub, coreutils, git, gnugrep, gnused, makeWrapper, inotify-tools }:
2
3stdenv.mkDerivation rec {
4 pname = "git-sync";
5 version = "unstable-2022-03-20";
6
7 src = fetchFromGitHub {
8 owner = "simonthum";
9 repo = "git-sync";
10 rev = "8466b77a38b3d5e8b4ed9e3cb1b635e475eeb415";
11 sha256 = "sha256-8rCwpmHV6wgFCLzPJOKzwN5mG8uD5KIlGFwcgQD+SK4=";
12 };
13
14 nativeBuildInputs = [ makeWrapper ];
15
16 dontBuild = true;
17
18 installPhase = ''
19 mkdir -p $out/bin
20 cp -a git-* $out/bin/
21 cp -a contrib/git-* $out/bin/
22 '';
23
24 wrapperPath = with lib; makeBinPath ([
25 coreutils
26 git
27 gnugrep
28 gnused
29 ] ++ lib.optionals stdenv.isLinux [ inotify-tools ]);
30
31 postFixup = ''
32 wrap_path="${wrapperPath}":$out/bin
33
34 wrapProgram $out/bin/git-sync \
35 --prefix PATH : $wrap_path
36
37 wrapProgram $out/bin/git-sync-on-inotify \
38 --prefix PATH : $wrap_path
39 '';
40
41 meta = {
42 description = "A script to automatically synchronize a git repository";
43 homepage = "https://github.com/simonthum/git-sync";
44 maintainers = with lib.maintainers; [ imalison ];
45 license = lib.licenses.cc0;
46 platforms = with lib.platforms; unix;
47 };
48}