Summary
Add a dwell setup command that backs up all currently installed tools and packages on the current system, and can reinstall them on a fresh machine. Combines the existing dwell deps scan data with full system package enumeration to create a portable restore plan.
Motivation
Currently dwell deps scan only detects dependencies referenced by the managed dotfiles. But a full machine restore needs more:
- System packages installed via apt/pacman/brew that are not referenced by any dotfile (build tools, media codecs, drivers)
- Cargo-installed tools (cargo install --list)
- Go tools (~/go/bin/)
- pipx-installed Python tools
- npm/yarn global packages
- Flatpak / Snap packages
- Manual binaries in ~/bin/ or /usr/local/bin/ from GitHub releases
- Non-dotfile configuration (app data, browser profiles)
Proposed design
dwell setup capture
dwell setup capture # Full system capture to .dwell/setup/
dwell setup capture --no-sys-packages # Skip system package enumeration
dwell setup capture --output ~/backup # Custom output directory
Captured structure:
.dwell/setup/
├── sys-packages/ # One file per backend
│ ├── apt.txt # dpkg -l | grep ^ii | awk '{print $2}'
│ ├── pacman.txt # pacman -Qq
│ ├── brew.txt # brew list --formula -1
│ └── nix.txt # nix profile list
├── language-tools/
│ ├── cargo.txt # cargo install --list (user-installed)
│ ├── go.txt # ls ~/go/bin/
│ ├── pipx.txt # pipx list --short
│ ├── npm-global.txt # npm ls -g --depth=0 --parseable
│ └── flatpak.txt # flatpak list --app --columns=application
├── manual/
│ ├── bin-list.txt # ls -1 ~/bin/ /usr/local/bin/ (non-distro)
│ └── notes.md # User notes about manual install steps
├── config/
│ └── paths.yaml # Non-dotfile config paths to preserve
└── manifest.yaml # Timestamps, hostname, OS, kernel
dwell setup restore
dwell setup restore # Full restore from .dwell/setup/
dwell setup restore --sys-packages # Only system packages
dwell setup restore --language-tools # Only language-specific tools
dwell setup restore --interactive # Ask before each step
Restore flow:
- Install system packages via apt/pacman/brew
- Install language tools via cargo install, pipx, npm -g
- Copy manual binaries from backup
- Copy config files from backup
dwell setup diff
dwell setup diff # Compare current vs captured state
Shows:
- Packages installed now but not in backup ("new")
- Packages in backup but not installed now ("missing")
- Version mismatches
Integration with existing features
- Reuses dwell deps scan data to filter dotfile-relevant vs system-level
- Reuses dwell package backends (apt, pacman, brew, nix) for system package operations
- Works alongside dwell sync to version-control the setup directory
Implementation notes
- Capture is read-only — never modifies system state
- Each capture file is a simple newline-separated list (one tool per line)
- manifest.yaml includes: capture date, hostname, OS, kernel version, backend availability
- Restore should be idempotent — skipping already-installed packages
- Language tool installers may need cargo, pipx, npm available first
- Manual binary list in ~/bin/ should be diffed against known package-manager installs
Acceptance criteria
Summary
Add a
dwell setupcommand that backs up all currently installed tools and packages on the current system, and can reinstall them on a fresh machine. Combines the existingdwell depsscan data with full system package enumeration to create a portable restore plan.Motivation
Currently
dwell deps scanonly detects dependencies referenced by the managed dotfiles. But a full machine restore needs more:Proposed design
dwell setup capture
Captured structure:
dwell setup restore
Restore flow:
dwell setup diff
dwell setup diff # Compare current vs captured stateShows:
Integration with existing features
Implementation notes
Acceptance criteria