Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gitwatch module #337273

Merged
merged 3 commits into from
Aug 27, 2024
Merged

Add gitwatch module #337273

merged 3 commits into from
Aug 27, 2024

Conversation

ein-shved
Copy link
Contributor

Create gitwatch script and module

Gitwatch is 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

Additionally, create module for gitwatch script. This module runs systemd services.
You are able to have several services for different paths at once.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

Change-Id: I2c39ccd6a13aa74ac1ae1bbf7c60163598019f62
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
Create module for gitwatch script. This module runs systemd services.
You are able to have several services for different paths at once.

Change-Id: If6100e883dd12a428f79881a80b9b88e683f6db9

wrapProgram $dest \
--prefix PATH ';' ${
lib.makeBinPath [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a minor nitpick, can the PATH be injected directly into the script rather than wrapping in an outer script?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please give me the link on how to do so?

@ehmry ehmry merged commit 183a78c into NixOS:master Aug 27, 2024
31 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants