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:
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
|
||||
devShells = forAllSystems (system:
|
||||
let
|
||||
|
||||
Reference in New Issue
Block a user