Skip to content

Gururagavendra/tuxsync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

39 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TuxSync

PROFILE SYNC FOR YOUR LINUX MACHINES

Linux PyPI Python License Maintained

Migration Assistant for Linux

Backup and restore your packages and configurations across Linux machines - like Apple's Migration Assistant or Chrome Sync, but private, open-source, and under your control. Your data stays in your GitHub account, not some company's servers.

Features

# Backup your files from your old machine
# basic backup (apps+packages+bashrc)
tuxsync backup

# full backup (apps+packages+all-dotfiles+config-files+secrets(encrypted))
tuxsync backup --use-chezmoi --chezmoi-repo username/dotfiles

# Restore on new machine
pip install tuxsync
tuxsync restore <GIST_ID>

# List your backups
tuxsync list
  • Multi-Distro Support - Ubuntu/Debian (apt), Fedora (dnf), and Arch (pacman)
  • Privacy First - GitHub Gists (convenient) or your own custom server (private)
  • Chezmoi Integration - Optional comprehensive dotfile management with encryption support (guide)
  • Loose Coupling - Uses tuxmate, tuxmate-cli, and chezmoi as external executors
  • Smart Scanning - Only backs up user-installed packages, filters out libraries
  • Magic Restore - One-liner command to restore your setup on any Linux machine

See Usage section below for detailed commands.

Installation

pip install tuxsync --upgrade

Usage

Quick Start

# Backup your current system
tuxsync backup

# Restore on a new machine
tuxsync restore <GIST_ID>

Basic Backup (Packages Only)

# Interactive mode (recommended)
tuxsync backup

# Non-interactive mode
tuxsync backup --github --non-interactive

What happens:

  1. Scans your system for user-installed packages (filters out libraries)
  2. Backs up your ~/.bashrc file
  3. Uploads to GitHub Gist (private by default)
  4. Gives you a magic restore command

Full Backup (Packages + ALL Dotfiles)

# Backup everything with chezmoi integration
tuxsync backup --use-chezmoi --chezmoi-repo username/dotfiles

What happens:

  1. Backs up all packages (same as basic)
  2. Auto-installs chezmoi if not present
  3. Initializes chezmoi with your dotfiles repository
  4. You can then add your dotfiles manually

πŸ’‘ Learn more:

Basic Restore (Packages Only)

# Using the magic one-liner (no installation needed!)
curl -sL https://raw.githubusercontent.com/Gururagavendra/tuxsync/main/restore.sh | bash -s -- <GIST_ID>

# Or install TuxSync first
pip install tuxsync
tuxsync restore <GIST_ID>

What happens:

  1. Downloads package list from GitHub Gist
  2. Installs packages using tuxmate-cli (cross-distro magic!)
  3. Restores your .bashrc file

Full Restore (Packages + Dotfiles)

tuxsync restore <GIST_ID> --use-chezmoi --chezmoi-repo username/dotfiles

What happens:

  1. Restores all packages (same as basic)
  2. Auto-installs chezmoi if not present
  3. Clones your dotfiles repository
  4. Applies all dotfiles system-wide
  5. Your entire environment is restored!

Advanced Options

# Dry run (see what would happen without making changes)
tuxsync restore <GIST_ID> --dry-run

# Skip specific components
tuxsync backup --no-bashrc                    # Skip .bashrc backup
tuxsync restore <GIST_ID> --skip-packages     # Only restore configs
tuxsync restore <GIST_ID> --skip-bashrc       # Only restore packages

# Merge bashrc instead of replacing
tuxsync restore <GIST_ID> --merge-bashrc

# Non-interactive mode (for automation)
tuxsync backup --github --non-interactive
tuxsync restore <GIST_ID> --yes

# List your backups
tuxsync list

Real-World Scenarios

Scenario 1: New Laptop (Basic)

# Old laptop
$ tuxsync backup
# βœ“ Backup ID: abc123def456

# New laptop (any distro!)
$ pip install tuxsync
$ tuxsync restore abc123def456
# βœ“ All packages installed!

Scenario 2: New Laptop (Full Setup)

# Old laptop
$ tuxsync backup --use-chezmoi --chezmoi-repo myusername/dotfiles

# New laptop
$ pip install tuxsync
$ tuxsync restore abc123def456 --use-chezmoi --chezmoi-repo myusername/dotfiles
# βœ“ Packages + entire dotfile setup restored!

Scenario 3: Distro Hopping (Ubuntu β†’ Arch)

# On Ubuntu
$ tuxsync backup --use-chezmoi --chezmoi-repo user/dotfiles

# Switch to Arch Linux
$ pip install tuxsync
$ tuxsync restore abc123def456 --use-chezmoi --chezmoi-repo user/dotfiles
# βœ“ TuxSync translates apt packages to pacman equivalents!

What Gets Backed Up

Component Basic Backup With --use-chezmoi
User-installed packages βœ… βœ…
System libraries ❌ (auto-filtered) ❌
~/.bashrc βœ… βœ…
All dotfiles (~/.vimrc, ~/.gitconfig, etc.) ❌ βœ… (manual)
Entire ~/.config/ directory ❌ βœ… (manual)
SSH configs ❌ βœ… (manual, encrypted)
Encrypted secrets ❌ βœ… (manual, encrypted)

See Managing Dotfiles with Chezmoi for details on what's automatic vs manual.

Requirements

  • Python 3.10+
  • GitHub CLI (gh) - For GitHub Gist storage
  • tuxmate-cli - Auto-downloaded when needed
  • chezmoi - Auto-installed when using --use-chezmoi
  • gum (optional) - For interactive menus

Development

git clone https://github.com/Gururagavendra/tuxsync.git
cd tuxsync
uv sync
./tuxsync.sh help

How It Works

TuxSync creates a backup containing your package list and bashrc, stored as a private GitHub Gist. The restore process fetches this backup and uses tuxmate-cli to install packages across different Linux distributions.

Architecture:

  • TuxSync - The Orchestrator (coordinates backup/restore workflow)
  • tuxmate-cli - Package Manager (handles cross-distro package installation using tuxmate's curated package database)
  • chezmoi - Dotfile Manager (optional integration for comprehensive dotfile syncing)

Documentation:

Managing Dotfiles with Chezmoi

When using --use-chezmoi, TuxSync integrates with chezmoi for comprehensive dotfile management.

Quick Overview

Important: Chezmoi does NOT automatically add files - you have full control over what gets backed up.

Quick Start

# Initial backup
tuxsync backup --use-chezmoi --chezmoi-repo username/dotfiles

# Add dotfiles
chezmoi add ~/.vimrc ~/.gitconfig ~/.config/nvim

# Add encrypted secrets
chezmoi add --encrypt ~/.ssh/id_rsa
chezmoi add --encrypt ~/.docker/config.json

# View managed files
chezmoi managed

# Push changes
cd ~/.local/share/chezmoi && git push

πŸ“– Complete Guide: Managing Dotfiles with Chezmoi
Detailed instructions on adding files, encryption setup, exclusions, and troubleshooting.


Backing Up Sensitive Credentials

TuxSync supports backing up sensitive data like SSH keys, Docker credentials, cloud provider tokens, and more using encrypted storage via chezmoi integration.

Quick Overview

# Step 1: Setup encryption (one-time)
sudo apt install age
age-keygen -o ~/.config/chezmoi/key.txt

# Step 2: Backup with chezmoi
tuxsync backup --use-chezmoi --chezmoi-repo username/dotfiles

# Step 3: Add encrypted secrets
chezmoi add --encrypt ~/.ssh/id_rsa
chezmoi add --encrypt ~/.docker/config.json

# Step 4: Push to repo
cd ~/.local/share/chezmoi && git push

# On new machine - credentials are automatically restored
tuxsync restore <GIST_ID> --use-chezmoi --chezmoi-repo username/dotfiles

Important: All sensitive data (SSH keys, credentials, tokens) is encrypted before leaving your machine using age or GPG encryption. Your secrets are never stored in plain text.

πŸ“– Full Guide: Backing Up Sensitive Credentials - Detailed security guide covering SSH keys, Docker credentials, cloud provider tokens, and more.


Status: Work in Progress

Early Development: TuxSync is actively being developed.

Implemented

  • βœ… Package scanning (apt, dnf, pacman)
  • βœ… GitHub Gist storage
  • βœ… bashrc backup/restore
  • βœ… tuxmate-cli integration
  • βœ… Dry-run mode
  • βœ… Chezmoi integration - Comprehensive dotfile management
  • βœ… Encrypted secrets support - SSH keys, credentials, tokens

Later

  • Sensitive file auto-detection with encryption prompts
  • Credential rotation helper on restore
  • Incremental backups - Only backup changes since last backup
  • Profile versioning - Keep multiple versions/snapshots with timestamps
  • Custom backup schedules and automation

Custom Server Support

Want to host backups on your own server instead of GitHub? See Custom Server API for implementation details.

Contributing

Contributions welcome! Please feel free to submit issues or pull requests.

License

GPL-3.0 License - See LICENSE for details.

Credits

  • Package restoration powered by tuxmate-cli
  • Package database from tuxmate by @abusoww - curated collection of 150+ Linux applications
  • dotfile management from chezmoi

About

THE MISSING profile sync FOR LINUX

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors