nixpkgs/pkgs/by-name/gi/gitwatch/package.nix
Yury Shvedov bd1a15057c gitwatch: init at v0.2
Useful script to automatically commit and push changes in watched
folders.

What to use it for?

* My case: **cad programs** which does not have their own version
  control or cloud. e.g. Kompas3D.

Next, copy-paste from README of project:

* **config files**: some programs auto-write their config files, without
  waiting for you to click an 'Apply' button; or even if there is such
  a button, most programs offer you no way of going  back to an earlier
  version of your settings. If you commit your config file(s) to a git repo,
  you can track changes and go back to older versions. This script makes it
  convenient, to have all changes recorded automatically.

* **document files**: if you use an editor that does not have built-in git
  support (or maybe if you don't like the git support it has), you can use
  gitwatch to automatically commit your files when you save them, or combine
  it with the editor's auto-save feature to fully automatically and regularly
  track your changes

Change-Id: I509dea55def25ccfbb36bf8a2bae685b51a757fb
2024-08-27 07:35:47 +00:00

50 lines
1.1 KiB
Nix

{
runCommand,
lib,
makeWrapper,
fetchFromGitHub,
git,
openssh,
inotify-tools,
}:
runCommand "gitwatch"
rec {
version = "0.2";
src = fetchFromGitHub {
owner = "gitwatch";
repo = "gitwatch";
rev = "v${version}";
hash = "sha256-KuWD2FAMi2vZ/7e4fIg97DGuAPEV9b9iOuF8NIGFVpE=";
};
nativeBuildInputs = [ makeWrapper ];
meta = {
description = "Watch a filesystem and automatically stage changes to a git.";
mainProgram = "gitwatch";
longDescription = ''
A bash script to watch a file or folder and commit changes to a git repo.
'';
homepage = "https://github.com/gitwatch/gitwatch";
changelog = "https://github.com/gitwatch/gitwatch/releases/tag/v${version}";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ shved ];
};
}
''
mkdir -p $out/bin
dest="$out/bin/gitwatch"
cp "$src/gitwatch.sh" $dest
chmod +x $dest
patchShebangs $dest
wrapProgram $dest \
--prefix PATH ';' ${
lib.makeBinPath [
git
inotify-tools
openssh
]
}
''