From bd1a15057c89902e2e9663dd448688616fb9ff56 Mon Sep 17 00:00:00 2001 From: Yury Shvedov Date: Sun, 25 Aug 2024 17:54:17 +0300 Subject: [PATCH] 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 --- pkgs/by-name/gi/gitwatch/package.nix | 49 ++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 pkgs/by-name/gi/gitwatch/package.nix diff --git a/pkgs/by-name/gi/gitwatch/package.nix b/pkgs/by-name/gi/gitwatch/package.nix new file mode 100644 index 000000000000..2bbd9a22c900 --- /dev/null +++ b/pkgs/by-name/gi/gitwatch/package.nix @@ -0,0 +1,49 @@ +{ + 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 + ] + } + ''