Justfile (3512B)
1 # Justfile 2 # ------------------------------------------------------------------------------ 3 # Dotfiles + secrets workflow 4 # 5 # Quick start: 6 # just bootstrap 7 # just backup 8 # just backup-secrets 9 # 10 # Notes: 11 # - This repo is intended to be cloned to: ~/.dotfiles 12 # - Encrypted archives should be committed ONLY to a private remote 13 # ------------------------------------------------------------------------------ 14 15 default := "help" 16 17 dotdir := env_var_or_default("DOTFILES_DIR", "~/.dotfiles") 18 private_dir := "private" 19 20 help: 21 @echo "" 22 @echo "Dotfiles & Secrets Commands" 23 @echo "--------------------------" 24 @echo "wizard 🧙 Interactive wizard for all operations (recommended!)" 25 @echo "bootstrap Install Homebrew (if needed), brew bundle install, link configs." 26 @echo "backup Update Brewfile and brew/leaves.txt from current machine." 27 @echo "backup-secrets Create encrypted archive (GPG/SSH/age/Skate) into private/." 28 @echo "restore-secrets A Decrypt and restore from archive A." 29 @echo "link Symlink dotfiles into expected locations (~/.zshrc, ~/.config/direnv/, etc)." 30 @echo "check Verify core tools exist (direnv, skate, age, just)." 31 @echo "" 32 @echo "When to use:" 33 @echo "- RECOMMENDED: just wizard (interactive, guided experience)" 34 @echo "- On a NEW machine: just bootstrap && just restore-secrets private/keys-YYYYMMDD.tar.gz.age" 35 @echo "- After changes: just backup && git commit" 36 @echo "- Periodically: just backup-secrets && git commit (private repo!)" 37 @echo "" 38 39 check: 40 @command -v direnv >/dev/null 2>&1 || (echo "Missing: direnv" && exit 1) 41 @command -v skate >/dev/null 2>&1 || (echo "Missing: skate" && exit 1) 42 @command -v age >/dev/null 2>&1 || (echo "Missing: age" && exit 1) 43 @command -v just >/dev/null 2>&1 || (echo "Missing: just" && exit 1) 44 @echo "OK" 45 46 # 🧙 Interactive wizard - the magical way to manage dotfiles 47 wizard: 48 @zsh {{justfile_directory()}}/bin/wizard 49 50 # Alias for wizard 51 w: wizard 52 easy: wizard 53 54 # Link configs into expected locations. 55 link: 56 @mkdir -p ~/.config/direnv 57 @mkdir -p ~/.config/git 58 @mkdir -p ~/.config/nvim 59 @mkdir -p ~/.config/redbrick 60 @mkdir -p ~/.config/yazi 61 62 @ln -snf {{justfile_directory()}}/zsh/zshrc ~/.zshrc 63 @echo "Linked ~/.zshrc" 64 @ln -snf {{justfile_directory()}}/config/direnv/direnvrc ~/.config/direnv/direnvrc 65 @echo "Linked ~/.config/direnv/direnvrc" 66 @ln -snf {{justfile_directory()}}/config/git/config ~/.gitconfig 67 @echo "Linked ~/.gitconfig" 68 @ln -snf {{justfile_directory()}}/config/git/config ~/.config/git/config 69 @echo "Linked ~/.config/git/config" 70 @ln -snf {{justfile_directory()}}/config/nvim/init.lua ~/.config/nvim/init.lua 71 @echo "Linked ~/.config/nvim/init.lua" 72 @ln -snf {{justfile_directory()}}/config/redbrick ~/.config/redbrick 73 @echo "Linked ~/.config/redbrick/*" 74 @ln -snf {{justfile_directory()}}/config/yazi/yazi.toml ~/.config/yazi/yazi.toml 75 @echo "Linked ~/.config/yazi/*" 76 @echo "Linked all dotfiles." 77 78 # Full new-machine setup. 79 bootstrap: 80 @bash {{justfile_directory()}}/bin/bootstrap 81 82 # Update Brewfile + leaves list. 83 backup: 84 @bash {{justfile_directory()}}/bin/backup 85 86 # Create encrypted backup archive in private/ 87 backup-secrets: 88 @mkdir -p {{justfile_directory()}}/{{private_dir}} 89 @bash {{justfile_directory()}}/bin/backup-secrets 90 91 # Restore from an encrypted archive 92 restore-secrets archive: 93 @bash {{justfile_directory()}}/bin/restore-secrets {{archive}} 94