hnm — HackerOS Nix Manager
Install Nix packages without the heavy NixOS setup.
Zero environments, zero flakes — just fast, clean package management
powered by nix-env with an HNM profile.
$ hnm install ripgrep bat htop
Overview #
HNM gives you access to the entire nixpkgs repository
(~100 000 packages) without having to manage Nix flakes, NixOS modules,
or configuration.nix. It works identically to how
Flox
uses Nix under the hood — a dedicated nix-env profile
at ~/.hnm/profile.
nixpkgs access
All ~100 000 packages from nixpkgs-unstable, searchable instantly.
No flakes / NixOS
Uses plain nix-env — no heavy system setup required.
Generations
Every change creates a new generation. Roll back with one command.
Version pinning
Pin packages to specific versions, preventing unwanted upgrades.
Doctor
Built-in diagnostics to verify your Nix install and HNM health.
Auto-bootstrap
HNM installs Nix automatically if it's missing — just run any command.
Quickstart #
# Search for a package $ hnm search ripgrep # Install packages $ hnm install ripgrep bat htop # Show information about a package $ hnm info ripgrep # List installed packages $ hnm list # Update everything $ hnm update # Remove a package $ hnm remove htop # Check Nix installation $ hnm check # Run full diagnostics $ hnm doctor
Command Reference #
Package commands
| Command | Description |
|---|---|
| hnm search <query> [--json] | Search nixpkgs for packages matching the query |
| hnm install <pkg...> [--no-env] | Install one or more packages into the HNM profile |
| hnm remove <pkg...> [-f] | Remove one or more installed packages |
| hnm update [pkg...] | Refresh the nixpkgs channel and upgrade packages |
| hnm upgrade | Upgrade HNM itself (placeholder — updated via system) |
| hnm info <pkg> | Show detailed information about a package |
| hnm list [-i] [--json] | List all installed packages |
| hnm which <pkg> | Show the binary path of an installed package |
| hnm pin <pkg> [version] | Pin a package to prevent it from being upgraded |
| hnm unpin <pkg> | Remove pin from a package |
| hnm rollback [gen] | Roll back to a previous generation |
| hnm gc | Run Nix garbage collection to free store space |
System commands
| Command | Description |
|---|---|
| hnm unpack | Bootstrap Nix: install, source profile, add nixpkgs-unstable channel |
| hnm check | Verify Nix installation — prints versions of nix and nix-env |
| hnm doctor | Full system diagnostics — Nix binaries, channels, profile, PATH |
| hnm env activate | Print shell snippet to add HNM profile to PATH |
| hnm env deactivate | Print instructions to remove HNM profile from PATH |
| hnm env status | Show current environment status |
| hnm clean | Remove HNM download cache and temporary files |
| hnm version | Show HNM and Nix version information |
| hnm help | Show command reference |
Command aliases
| Alias | Full command |
|---|---|
| hnm i | hnm install |
| hnm rm | hnm remove |
| hnm uninstall | hnm remove |
| hnm up | hnm update |
| hnm ls | hnm list |
Search & Install #
Searching
hnm search runs nix search nixpkgs <query> and displays
results in a formatted table. Installed packages are marked with a ✓.
│ parsing results...
/ [████████████████████████████████████████] 100% done
▸ Search 'ripgrep' (3 results)
────────────────────────────────────────────────────────────────────────────────
PACKAGE VERSION DESCRIPTION
────────────────────────────────────────────────────────────────────────────────
ripgrep 14.1.1 Fast grep alternative in Rust
ripgrep-all 0.9.6 Ripgrep, but also search PDFs etc
ugrep 6.1.0 Ultra fast grep with regex
hnm install <package> to install
hnm info <package> for details
# Basic search $ hnm search ripgrep # JSON output (useful for scripting) $ hnm search ripgrep --json
Installing
hnm install resolves the package in nixpkgs, installs it into
~/.hnm/profile via nix-env, and records it in the HNM
state file. Multiple packages can be installed in one command.
──────────────────────────────────
[1/2] installing ripgrep
│ nix-env --profile ~/.hnm/profile --install --attr nixpkgs#ripgrep
│ resolving nixpkgs#ripgrep...
│ fetching /nix/store/...-ripgrep-14.1.1
\ [████████████████████░░░░░░░░░░░░░░░░░░░░] 52% fetching ripgrep
│ unpacking...
| [████████████████████████████████████████] 100% ✓ ripgrep 14.1.1
[2/2] installing bat
│ nix-env --profile ~/.hnm/profile --install --attr nixpkgs#bat
- [████████████████████████████████████████] 100% ✓ bat 0.24.0
✓ all packages installed successfully
# Install a single package $ hnm install ripgrep # Install multiple packages at once $ hnm install ripgrep bat htop neovim fd # Install without activating profile (advanced) $ hnm install ripgrep --no-env
Updating Packages #
hnm update runs two steps: first it refreshes the nixpkgs channel
(nix-channel --update), then upgrades all installed packages
(nix-env --upgrade).
# Update everything $ hnm update # Update specific packages only $ hnm update ripgrep bat
[pinned: x.x.x]
marker. However, because HNM delegates the actual upgrade to
nix-env --upgrade, pinning currently prevents tracking but does not
block the underlying nix-env upgrade. Full pin enforcement is planned for a future release.
Pinning #
Pinning records a specific version in the HNM state file and marks the package so you know it should not be changed automatically.
# Pin at the currently installed version $ hnm pin ripgrep # Pin at a specific version $ hnm pin ripgrep 14.0.0 # Remove the pin $ hnm unpin ripgrep
Pinned packages appear in hnm list with a [pinned: x.x.x] annotation.
Generations & Rollback #
Every install, remove, or upgrade in nix-env creates a new generation —
a snapshot of the profile state. HNM exposes this through hnm rollback.
# Roll back to the previous generation $ hnm rollback # Roll back to a specific generation number $ hnm rollback 3 # The rollback command shows available generations first: gen 1 2024-12-01 gen 2 2025-01-15 gen 3 2025-03-22 ← current
Progress & Logs #
HNM uses a combined progress display: scrolling log lines above a live progress bar with a spinner, percentage, and current action label. Stderr from Nix commands is shown inline as error lines.
│ these 3 paths will be fetched (12.4 MiB download, 48.2 MiB unpacked):
│ /nix/store/abc123-neovim-0.10.2
│ /nix/store/def456-libuv-1.48.0
│ /nix/store/ghi789-luajit-2.1.0
│ copying path '/nix/store/def456-libuv-1.48.0' from 'https://cache.nixos.org'...
│ ERR warning: ignoring unknown setting 'experimental-features'
│ copying path '/nix/store/ghi789-luajit-2.1.0' from 'https://cache.nixos.org'...
│ copying path '/nix/store/abc123-neovim-0.10.2' from 'https://cache.nixos.org'...
/ [██████████████████████████░░░░░░░░░░░░░░] 65% installing neovim
The spinner cycles through / → - → \ → |.
Log lines scroll above the bar and are preserved in the terminal history once the
operation completes.
Color Scheme #
| Output type | Color | Style | Example |
|---|---|---|---|
| Errors | Red | Bold + Underline | ERROR cannot install 'xyz' |
| Warnings | Yellow | Underline | WARN package already installed |
| Primary (dominant) | Bright Cyan | Bold | ✓ ripgrep 14.1.1 installed |
| Secondary (less dominant) | Cyan | Normal / Dimmed | · resolving package... |
Doctor #
hnm doctor runs a full health check of your HNM and Nix setup.
It checks for required binaries, Nix channels, the HNM profile directory,
the Nix store, state and config files, and PATH configuration.
$ hnm doctor ▸ HNM Doctor — system diagnostics ────────────────────────────────────────────────── ✓ nix nix (Nix) 2.18.4 ✓ nix-env nix-env (Nix) 2.18.4 ✓ nix-channel nix-channel (Nix) 2.18.4 ✓ nix-store nix-store (Nix) 2.18.4 ✓ channels nixpkgs https://nixos.org/channels/nixpkgs-unstable ✓ profile /home/user/.hnm/profile ✓ /nix/store exists (4.2G) ✓ state 12 package(s) tracked ✓ config channel = https://nixos.org/channels/nixpkgs-unstable ✓ PATH contains .nix-profile ✓ all checks passed — HNM is healthy
Environment #
HNM packages are installed into ~/.hnm/profile/bin. To use them
in your shell, add the profile to your PATH.
# Print the snippet to add to your shell rc $ hnm env activate # Check current status $ hnm env status # Print removal instructions $ hnm env deactivate
Add to your ~/.bashrc or ~/.zshrc:
# HNM profile
export PATH="$HOME/.hnm/profile/bin:$PATH"
[ -f ~/.nix-profile/etc/profile.d/nix.sh ] && \
. ~/.nix-profile/etc/profile.d/nix.sh
Garbage Collection #
Nix keeps every version of every package in /nix/store. Over time this
can grow large. Run hnm gc to collect unreachable store paths.
$ hnm gc ▸ Nix garbage collection ──────────────────────────────── store size before 4.2G │ nix-store --gc │ finding garbage collector roots... │ deleting garbage... │ deleting '/nix/store/old-path-xyz' │ ... / [████████████████████████████████████████] 100% ✓ garbage collection complete store size after 2.1G ✓ done
Clean Cache #
hnm clean removes HNM's own download cache and the Nix evaluation cache.
It does not touch the Nix store — use hnm gc for that.
$ hnm clean ✓ removed ~/.cache/hnm (128 MB) ✓ removed nix eval cache (44 MB) ✓ freed 172 MB To free Nix store space, run: hnm gc
Auto Nix Bootstrap #
Every command that requires Nix (install, remove, search, update, gc, etc.)
checks whether Nix is present before running. If Nix is missing, HNM
automatically runs hnm unpack to bootstrap it —
no manual action required.
hnm unpack.
This is equivalent to running the official Nix single-user installer, sourcing
the profile, and registering nixpkgs-unstable as the default channel.
# Manually bootstrap Nix $ hnm unpack # This runs: # sh <(curl -L https://nixos.org/nix/install) --no-daemon # . ~/.nix-profile/etc/profile.d/nix.sh # nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs # nix-channel --update
Configuration #
HNM stores its configuration in ~/.config/hnm/config.toml. The file is
created automatically on first run with sensible defaults.
# ~/.config/hnm/config.toml nix_channel = "https://nixos.org/channels/nixpkgs-unstable" profile_dir = "/home/user/.hnm/profile" auto_gc = false max_generations = 10
| Key | Default | Description |
|---|---|---|
| nix_channel | nixpkgs-unstable URL | Nix channel to use for package resolution |
| profile_dir | ~/.hnm/profile | Path to the HNM nix-env profile |
| auto_gc | false | Run GC automatically after remove operations |
| max_generations | 10 | Number of generations to keep before pruning |
State File #
HNM tracks installed packages in ~/.local/share/hnm/state.json.
This is separate from the Nix profile itself and records HNM-specific metadata
such as install timestamps, descriptions, and pins.
{
"installed": {
"ripgrep": {
"name": "ripgrep",
"version": "14.1.1",
"attr_path": "nixpkgs#ripgrep",
"installed_at": "2025-04-17T10:32:00Z",
"pinned": null,
"description": "Fast grep alternative written in Rust"
}
},
"generation": 4,
"last_update": "2025-04-17T10:35:00Z"
}
HNM vs Flox #
| Feature | HNM | Flox |
|---|---|---|
| Package source | nixpkgs-unstable | nixpkgs + Flox catalog |
| Nix required | Auto-installs if missing | Auto-installs if missing |
| Environments / manifests | None — direct install | Per-environment manifest |
| Profile location | ~/.hnm/profile | ~/.local/share/flox/environments |
| Flakes | No | Yes (internally) |
| Version pinning | Yes (tracked in state.json) | Yes (in manifest) |
| Rollback | nix-env generations | Flox generations |
| HackerOS integration | Built-in ✓ | No |
| Written in | Rust | Rust |