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 <noreply@anthropic.com>
This commit is contained in:
73
README.md
73
README.md
@@ -11,15 +11,78 @@ A NixOS-based system for managing the three types of data in a computer:
|
|||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
```bash
|
```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
|
git clone https://github.com/YOUR_USERNAME/ultimate-notetaking-sync-backup-system.git
|
||||||
cd ultimate-notetaking-sync-backup-system
|
cd ultimate-notetaking-sync-backup-system
|
||||||
|
|
||||||
# Option 1: Just try the tools (no system changes)
|
# 2. Run setup (one command - includes all dependencies)
|
||||||
nix develop
|
nix run .
|
||||||
|
# Or: nix develop && ./setup
|
||||||
|
|
||||||
# Option 2: Apply as a NixOS module
|
# 3. Choose option [1] "New setup (first device)"
|
||||||
# Add to your flake.nix inputs, then import the module
|
# 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 <git-url> <your-age-key>
|
||||||
|
```
|
||||||
|
|
||||||
|
### 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
|
## Philosophy
|
||||||
|
|||||||
48
flake.nix
48
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
|
# Development shell with all tools
|
||||||
devShells = forAllSystems (system:
|
devShells = forAllSystems (system:
|
||||||
let
|
let
|
||||||
|
|||||||
Reference in New Issue
Block a user