Automatic syncing of desktop files to git
 
 
 
Go to file
Joshua Potter 014a7d72e5 Allow specifying SSH keys and clean up config further. 2022-01-08 05:15:15 -05:00
.githooks Add git dependencies and prep for async. 2021-12-31 10:17:55 -05:00
examples Allow specifying SSH keys and clean up config further. 2022-01-08 05:15:15 -05:00
src Allow specifying SSH keys and clean up config further. 2022-01-08 05:15:15 -05:00
.envrc Basic project template. 2021-12-28 17:06:17 -05:00
.gitignore Basic project template. 2021-12-28 17:06:17 -05:00
Cargo.toml Setup apply to sync between desktop and homesync repo. 2022-01-06 07:24:04 -05:00
README.md Drop init subcommand. 2022-01-07 06:32:34 -05:00
flake.lock Basic project template. 2021-12-28 17:06:17 -05:00
flake.nix Setup apply to sync between desktop and homesync repo. 2022-01-06 07:24:04 -05:00

README.md

homesync

Caution! This is a work in progress and far from complete!

Introduction

Homesync provides a way of automatically syncing config files across various applications you may use. It works by establishing a file watcher on all the configs specified in the primary homesync config. As files are changed, they are copied to a local git repository to eventually be pushed by the user. Likewise, at any point, the user can sync against the remote repository, overwriting local configurations for one or more packages.

Installation

TODO

Configuration

Homesync uses a YAML file, to be found in anyone of the following locations. Locations are searched in the following priority:

  • $HOME/.homesync.yml
  • $HOME/.config/homesync/homesync.yml
  • $XDG_CONFIG_HOME/homesync.yml
  • $XDG_CONFIG_HOME/homesync/homesync.yml

The config file should look like the following:

---
user:
  name: jrpotter
  email: jrpotter@github.io
local: $HOME/.homesync
remote:
  name: origin
  branch: master
  url: "https://github.com/jrpotter/home-config.git"
packages:
  homesync:
    configs:
      - $HOME/.homesync.yml
      - $HOME/.config/homesync/homesync.yml
      - $XDG_CONFIG_HOME/homesync.yml
      - $XDG_CONFIG_HOME/homesync/homesync.yml
  ...

Copy over examples/template.yaml to where you'd like as a starting point.

Usage

Verify your installation by running homesync from the command line. To have your local repository match the remote, run

$ homesync pull

If you make a change to a configuration tracked by homesync, you can tell homesync to prep pushing those changes via the stage subcommand or rely on the daemon service to do it for you:

$ homesync stage
$ homesync daemon &

Homesync will find all tracked files that have changed and stage them in the local repository. You can then push those changes using

$ homesync push

If looking to copy a configuration tracked by homesync to your desktop, you can run

$ homesync apply <filename>

To copy all configurations (and optionally overwrite files that already exist), you can run

$ homesync apply --all [--overwrite]

Known Issues

If using (neo)vim, the daemon watcher will stop watching a given configuration file after editing. Refer to this issue for more details. As a workaround, you can set the following in your init.vim file:

backupcopy=yes

Refer to :h backupcopy for details on how this works.

Contribution

Install git hooks as follows:

git config --local core.hooksPath .githooks/