nh-{os, home, clean, search}: add page (#20621)

Co-authored-by: Managor <42655600+Managor@users.noreply.github.com>
This commit is contained in:
mana-byte
2026-01-16 16:02:34 +01:00
committed by GitHub
parent f8a38cb6c2
commit 55c204c085
5 changed files with 96 additions and 17 deletions
+17
View File
@@ -0,0 +1,17 @@
# nh clean
> Clean Nix profiles and delete unused and unreachable Nix store paths.
> Generations can be listed using `nix-env --list-generations` or `nh os info`.
> More information: <https://github.com/nix-community/nh#usage>.
- Ask for clean up plan confirmation, clean all profiles and collect garbage:
`nh clean all {{[-a|--ask]}}`
- Keep a specified number of the most recent profiles for the current user and clean the remaining profiles:
`nh clean user {{[-k|--keep]}} {{number}}`
- Clean a specific profile and collect garbage:
`nh clean profile {{path/to/profile}}`
+17
View File
@@ -0,0 +1,17 @@
# nh home
> Manage and configure per-user environment using Nix.
> Reimplementation of `home-manager`.
> More information: <https://github.com/nix-community/nh#usage>.
- Build and switch to a specified Home Manager flake configuration:
`nh home switch {{path/to/flake}}`
- Update all the flake inputs of the specified Home Manager flake configuration and build it:
`nh home build {{path/to/flake}} {{[-u|--update]}}`
- Load a specified Home Manager flake configuration in Nix REPL (Nix evaluation environment):
`nh home repl {{path/to/flake}}`
+32
View File
@@ -0,0 +1,32 @@
# nh os
> Reconfigure or debug a NixOS machine.
> More information: <https://github.com/nix-community/nh#usage>.
- Build and switch to a specified NixOS flake configuration:
`nh os switch {{path/to/flake}}`
- Update all the flake inputs of the specified NixOS flake configuration, build it and make it the boot default:
`nh os boot {{path/to/flake}} {{[-u|--update]}}`
- Build and activate a specified NixOS flake configuration specialisation:
`nh os test {{path/to/flake}} {{[-s|--specialisation]}} {{specialisation}}`
- Build a specified NixOS flake configuration host and create a symlink of the result from the Nix store in the current directory:
`nh os build-vm {{path/to/flake}} {{[-H|--hostname]}} {{host}}`
- Load a specified NixOS flake configuration in Nix REPL (Nix evaluation environment):
`nh os repl {{path/to/flake}}`
- List all available generations from profile path:
`nh os info`
- Rollback to a specified generation:
`nh os rollback {{[-t|-to]}} {{generation}}`
+16
View File
@@ -0,0 +1,16 @@
# nh search
> Search for packages in Nixpkgs.
> More information: <https://github.com/nix-community/nh#usage>.
- Search for a package in Nixpkgs, limiting results:
`nh search {{[-l|--limit]}} {{number}} {{name}}`
- Search for a package in a specified Nixpkgs channel:
`nh search {{[-c|--channel]}} {{nixos-unstable}} {{name}}`
- Search for a package in Nixpkgs, showing supported platforms for each package:
`nh search {{[-P|--platforms]}} {{name}}`
+14 -17
View File
@@ -1,32 +1,29 @@
# nh
> Modern helper utility tool for the Nix/Nixos ecosystem.
> Modern helper utility tool for the Nix/NixOS ecosystem.
> Some subcommands such as `os`, `home`, `clean`, `search` have their own usage documentation.
> More information: <https://github.com/nix-community/nh#usage>.
- Search for a package in Nixpkgs, limiting results:
- Build and switch to a specified NixOS flake configuration:
`nh search {{[-l|--limit]}} {{number}} {{name}}`
`nh os switch {{path/to/flake}}`
- Collect all garbage and gcroots from the Nix store:
- Build and switch to a specified Home Manager flake configuration:
`nh clean all {{[-a|--ask]}}`
- Build a specified Nixos flake configuration and create a symlink of the result from the Nix store:
`nh os build-vm {{path/to/flake}} {{[-H|--hostname]}} {{host}}`
- Build and test a specified Nixos flake configuration:
`nh os test {{path/to/flake}} {{[-H|--hostname]}} {{nixos}}`
- Build and switch to a specified Home manager flake configuration:
`nh home switch {{path/to/flake}} {{[-c|--configuration]}} {{home}}`
`nh home switch {{path/to/flake}}`
- Build and switch to a nix-darwin flake configuration:
`nh darwin switch {{path/to/flake}} {{[-H|--hostname]}} {{host}}`
- Collect all garbage and gcroots from the Nix store:
`nh clean all {{[-a|--ask]}}`
- Search for a package in Nixpkgs:
`nh search {{name}}`
- Generate shell completions for a specified shell:
`nh completions {{shell}}`