9 releases
Uses new Rust 2024
| 0.1.8 | Jul 17, 2026 |
|---|---|
| 0.1.7 | Jul 17, 2026 |
| 0.1.6 | Jun 5, 2026 |
| 0.1.5 | May 23, 2026 |
#2250 in Command line utilities
180KB
4K
SLoC
NixBox
A NixOS TUI package manager. Search a nixpkgs channel, pick a package, and NixBox writes it into your home-manager or NixOS config and runs the rebuild — without ever leaving the terminal.
What it does
- Live search against
nix search --jsonover a configurable flake input (defaultnixpkgs). - Maintains two managed files in your config directory —
nixbox-home-packages.nixandnixbox-system-packages.nix— and owns them end-to-end. Your hand-written config is never touched outside of a singleimportsline. - On install/uninstall it updates the managed file, makes sure it's imported by your
home.nix/configuration.nix, then runs the appropriate rebuild and streams the output into the TUI. - Works whether your home-manager is exposed as a standalone
homeConfigurations.<user>flake output, or wired in as a NixOS module — NixBox auto-detects which one you have and picks the right rebuild command. - Scans your existing config for externally-declared packages and lets you "migrate" them into the managed file with
m(orMfor all of them). - Settings (channel, target, theme, paths) persist in
~/.config/nixbox/settings.json.
How it wires itself in
The first time you install or migrate a package, NixBox does three things automatically:
- Writes the managed file (
nixbox-home-packages.nixfor home-manager,nixbox-system-packages.nixfor NixOS). - Inserts
./nixbox-home-packages.nix(or…-system-…) into theimports = [ … ]list of yourhome.nix/configuration.nix. Existing imports-list style is preserved, and the insertion is idempotent. - Stages the managed file with
git add -Nif your config dir is a git work tree, so flakes (which ignore untracked files) can actually evaluate it.
If you want to override where NixBox looks for the "main" config file, set home_manager_main_file or nixos_main_file in ~/.config/nixbox/settings.json.
Inside the managed file, NixBox owns everything between # nixbox:packages:start and # nixbox:packages:end. Don't edit those by hand.
Install
cargo install nixbox
Or build from source:
devenv shell
cargo build --release
Run
nixbox # if cargo-installed
devenv shell -- just run # from a checkout
Development
The reproducible development environment is managed by devenv:
devenv shell # Rust toolchain, Nix tooling, and just
just ci # format, lint, and test the workspace
devenv test # evaluate the environment and run just ci
devenv update # update pinned inputs
With direnv installed, run direnv allow once to activate the environment automatically.
Layout
Cargo workspace:
crates/nixbox— binary entrypointcrates/nixbox-tui— ratatui app, search / installed / build viewscrates/nixbox-nix—nix searchwrapper, managed-file writer, import inserter, rebuild runnercrates/nixbox-config— persisted user settings (channel, target, theme, path overrides)
Keys
| key | action |
|---|---|
type / / / i |
enter search |
↑ ↓ / k j |
move selection |
| Enter | install selected package |
d / Delete |
uninstall selected (Installed tab) |
m |
migrate selected external package |
M |
migrate all migratable externals |
c |
cancel active build (Building tab) |
Tab / l |
next tab (Search → Installed → Build) |
Shift-Tab / h |
previous tab |
| Ctrl-T | toggle home-manager / nixos target |
| Ctrl-N | cycle theme |
| Esc / Ctrl-C | quit |
Dependencies
~19–38MB
~472K SLoC