MyNixOS website logo
Description

Synchronize personal configs across multiple machines.

Synchronize personal configs across multiple machines. See README for more details.

life-sync

Hackage Build status MIT license Stackage LTS Stackage Nightly

life-sync is a CLI tool that makes it easier to synchronize a repository of personal config files across multiple machines.

Motivation

You might have some configuration files with different settings for your system. For example:

  1. Preferred settings for your editors (Spacemacs, Vim, etc.).
  2. Useful bash aliases and other miscellaneous shell settings.
  3. Git configuration.

And much more! But sometimes you start working from a fresh machine without having your settings within reach, as in these situations:

  1. You bought a new PC or laptop.
  2. You reinstalled the operating system on your machine.
  3. You were given a new laptop at work.

Every time this happens, you need to walk through the tedious process of copying your data again. It's a well-known practice to store configs in a dotfiles GitHub repository. And life-sync makes it much easier to maintain this repository! With a single command, your can copy every file and directory from your dotfiles repository to your machine. Or update your remote dotfiles repository after multiple local changes to different files.

Prerequisites

  • git
  • hub
  • SSH access to Github configured

Installation

There are several ways to install life on your machine. Here are detailed instructions on different approaches.

From Hackage/Stackage

Install with one simple command:

$ cabal install life-sync

or

$ stack install life-sync

Homebrew

If you are on MacOS, you can get life-sync using Homebrew Kowainik's Tap.

You need to run the following commands for that:

$ brew tap kowainik/tap
$ brew install life-sync

Ubuntu

If you are on Ubuntu, you can get life-sync from Kowainik's PPA.

You need to run the following commands for that:

$ sudo add-apt-repository ppa:kowainik/life-sync
$ sudo apt update
$ sudo apt install life-sync

Setup

You can turn on bash auto-completion by running the following command:

$ source <(life --bash-completion-script `which life`)

Usage

After installing life-sync you need to call the command life with specified options:

$ life --help
Usage: life COMMAND
  life-sync synchronize your personal configs

Available options:
  -h,--help                Show this help text

Available commands:
  init                     Initialize GitHub repository named 'dotfiles' if you
                           don't have one.
  add                      Add file or directory to the life configuration.
  remove                   Remove file or directory from the life configuration.
  push                     Updates GitHub repository from local state and push
                           the latest version.
  pull                     Updates local state of '.life' and 'dotfiles' from
                           GitHub repository.

`life init` usage: life init OWNER
  OWNER                    Your github user name

`life add` usage: life add ((-f|--file FILE_PATH) | (-d|--dir DIRECTORY_PATH))
  -f,--file FILE_PATH      File to add
  -d,--dir FILE_PATH       Directory to add

`life remove` usage: life remove ((-f|--file FILE_PATH) | (-d|--dir DIRECTORY_PATH))
  -f,--file FILE_PATH      File to remove
  -d,--dir FILE_PATH       Directory to remote

`life push` usage: life push

`life pull` usage: life pull OWNER [-f|--no-file FILE_PATH] [-d|--no-dir FILE_PATH]
  OWNER                    Your github user name
  -f,--no-file FILE_PATH   Excluding these specific files from copying
  -d,--no-dir FILE_PATH    Excluding these specific directories from copying

NOTE: If a command takes a path to a file or a directory as an argument, the path should be specifed relative to the home directory.

life-sync keeps the structure of your dotfiles repository in its own file called .life which is also stored in your dotfiles repository.

You can see an example of a dotfiles repository maintained by life-sync here:

Examples

Create a dotfiles repository for the first time

$ life init MyGithubName

Track a new file or directory

To track a file:

$ life add -f path/to/file/relative/from/home

To track a directory:

$ life add -d path/to/dir/relative/from/home

To stop tracking some file, use life remove instead.

Push all changes to the remote repository

$ life push

Pull all changes from the remote repository

To pull every file and directory:

$ life pull ChShersh

To pull everything except some files or some directories:

$ life pull ChShersh --no-file some/file --no-dir some/dir
Metadata

Version

1.1.1.0

License

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows