From 521a2431c2f038f6bbf5355dc8aa501ab4eb4726 Mon Sep 17 00:00:00 2001 From: Brandon Lucas Date: Fri, 13 Feb 2026 08:21:24 -0500 Subject: [PATCH] Add one-command setup via nix run - Add flake app so setup can be run with: nix run . - Update README with comprehensive setup guide for: - First computer (initial setup) - Additional computers (joining) - Mobile device pairing - NixOS module usage Co-Authored-By: Claude Opus 4.5 --- README.md | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++---- flake.nix | 48 ++++++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2bbec39..836ebdd 100644 --- a/README.md +++ b/README.md @@ -11,15 +11,78 @@ A NixOS-based system for managing the three types of data in a computer: ## Quick Start ```bash -# Clone this repo +# One-command setup (interactive) +nix run github:YOUR_USERNAME/ultimate-notetaking-sync-backup-system + +# Or clone first +git clone https://github.com/YOUR_USERNAME/ultimate-notetaking-sync-backup-system.git +cd ultimate-notetaking-sync-backup-system +nix run . +``` + +## Full Setup Guide + +### First Computer (Initial Setup) + +```bash +# 1. Clone the repo git clone https://github.com/YOUR_USERNAME/ultimate-notetaking-sync-backup-system.git cd ultimate-notetaking-sync-backup-system -# Option 1: Just try the tools (no system changes) -nix develop +# 2. Run setup (one command - includes all dependencies) +nix run . +# Or: nix develop && ./setup -# Option 2: Apply as a NixOS module -# Add to your flake.nix inputs, then import the module +# 3. Choose option [1] "New setup (first device)" +# This generates an age encryption key - SAVE IT! + +# 4. Push config to your git server +cd ~/.config/usync/config +git remote add origin git@your-server:you/config.git +git push -u origin main +``` + +### Additional Computers (Joining) + +```bash +# One command with your git URL and age key +nix run github:YOUR_USERNAME/ultimate-notetaking-sync-backup-system +# Choose option [2], enter your git URL and age key + +# Or non-interactively: +nix develop +./setup +``` + +### Mobile Device (Phone/Tablet) + +```bash +# On any computer that's already set up: +nix run . -- mobile + +# Or: ./setup mobile +``` + +This shows a QR code for Syncthing pairing. You can also manually paste device IDs. + +### Just Try the Tools (No Setup) + +```bash +nix develop +# Provides: nb, syncthing, restic, rclone, age, sops, etc. +``` + +### Apply as NixOS Module + +Add to your flake.nix inputs, then import the module: + +```nix +{ + inputs.unsbs.url = "github:YOUR_USERNAME/ultimate-notetaking-sync-backup-system"; + + # In your configuration: + imports = [ inputs.unsbs.nixosModules.default ]; +} ``` ## Philosophy diff --git a/flake.nix b/flake.nix index 4c52d7e..bb43cf9 100644 --- a/flake.nix +++ b/flake.nix @@ -76,6 +76,54 @@ # }; # }; + # One-command setup: nix run . + apps = forAllSystems (system: + let + pkgs = nixpkgsFor.${system}; + setupScript = pkgs.writeShellApplication { + name = "unsbs-setup"; + runtimeInputs = with pkgs; [ + git + jq + age + sops + syncthing + qrencode + zbar + ffmpeg + ]; + text = '' + # Find the setup script + SCRIPT_DIR="''${UNSBS_DIR:-}" + if [[ -z "$SCRIPT_DIR" ]]; then + # Try current directory first + if [[ -f "./setup" ]]; then + SCRIPT_DIR="." + # Try the flake source + elif [[ -f "${self}/setup" ]]; then + SCRIPT_DIR="${self}" + else + echo "Error: Cannot find setup script" + echo "Run from the repo directory, or clone it first:" + echo " git clone https://github.com/YOUR_USERNAME/ultimate-notetaking-sync-backup-system.git" + exit 1 + fi + fi + exec "$SCRIPT_DIR/setup" "$@" + ''; + }; + in { + default = { + type = "app"; + program = "${setupScript}/bin/unsbs-setup"; + }; + setup = { + type = "app"; + program = "${setupScript}/bin/unsbs-setup"; + }; + } + ); + # Development shell with all tools devShells = forAllSystems (system: let