From 55c204c085757136b194f3e92f55d09d6753a755 Mon Sep 17 00:00:00 2001 From: mana-byte <93316844+mana-byte@users.noreply.github.com> Date: Fri, 16 Jan 2026 16:02:34 +0100 Subject: [PATCH] nh-{os, home, clean, search}: add page (#20621) Co-authored-by: Managor <42655600+Managor@users.noreply.github.com> --- pages/common/nh-clean.md | 17 +++++++++++++++++ pages/common/nh-home.md | 17 +++++++++++++++++ pages/common/nh-os.md | 32 ++++++++++++++++++++++++++++++++ pages/common/nh-search.md | 16 ++++++++++++++++ pages/common/nh.md | 31 ++++++++++++++----------------- 5 files changed, 96 insertions(+), 17 deletions(-) create mode 100644 pages/common/nh-clean.md create mode 100644 pages/common/nh-home.md create mode 100644 pages/common/nh-os.md create mode 100644 pages/common/nh-search.md diff --git a/pages/common/nh-clean.md b/pages/common/nh-clean.md new file mode 100644 index 0000000000..d1f9aebf56 --- /dev/null +++ b/pages/common/nh-clean.md @@ -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: . + +- 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}}` diff --git a/pages/common/nh-home.md b/pages/common/nh-home.md new file mode 100644 index 0000000000..2cb0f607d9 --- /dev/null +++ b/pages/common/nh-home.md @@ -0,0 +1,17 @@ +# nh home + +> Manage and configure per-user environment using Nix. +> Reimplementation of `home-manager`. +> More information: . + +- 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}}` diff --git a/pages/common/nh-os.md b/pages/common/nh-os.md new file mode 100644 index 0000000000..06100c8cb0 --- /dev/null +++ b/pages/common/nh-os.md @@ -0,0 +1,32 @@ +# nh os + +> Reconfigure or debug a NixOS machine. +> More information: . + +- 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}}` diff --git a/pages/common/nh-search.md b/pages/common/nh-search.md new file mode 100644 index 0000000000..58bafebe28 --- /dev/null +++ b/pages/common/nh-search.md @@ -0,0 +1,16 @@ +# nh search + +> Search for packages in Nixpkgs. +> More information: . + +- 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}}` diff --git a/pages/common/nh.md b/pages/common/nh.md index 58017ecb22..8b1cbf2554 100644 --- a/pages/common/nh.md +++ b/pages/common/nh.md @@ -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: . -- 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}}`