Nix: update and add documentation for nix subcommands (#9959)

* Nix: update and add documentation for nix subcommands

Updates the documentation on the new unstable Nix command & subcommands,
and adds a separate page for the Classic Nix commands.

---------

Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
Co-authored-by: axtloss <axtlos@getcryst.al>
Co-authored-by: CleanMachine1 <78213164+CleanMachine1@users.noreply.github.com>
This commit is contained in:
Alexander Bantyev
2023-04-26 12:45:00 +04:00
committed by GitHub
parent cf645f1ad2
commit 1ca4896e3b
17 changed files with 327 additions and 14 deletions

View File

@@ -1,24 +1,34 @@
# nix
> Utilities for the Nix language and store.
> More information: <https://nixos.org>.
> Powerful package manager that makes package management reliable, reproducible, and declarative.
> The `nix` command-line utility is experimental and requires enabling experimental features. For a classic, stable interface, see `tldr nix classic`.
> Some `nix` subcommands such as `build`, `develop`, `flake`, `registry`, `profile`, `search`, `repl`, `store`, `edit`, `why-depends` etc. have their own usage documentation, accessible via `tldr nix3 subcommand`.
> More information: <https://nixos.org/manual/nix>.
- Search for a package via its name or description:
- Enable the `nix` command:
`nix search {{search_term}}`
`mkdir -p ~/.config/nix; echo 'experimental-features = nix-command flakes' > ~/.config/nix/nix.conf`
- Start a Nix shell with the specified packages available:
- Display help for the `nix` subcommand:
`nix run {{nixpkgs.pkg1 nixpkgs.pkg2 nixpkgs.pkg3...}}`
`nix help {{subcommand}}`
- Optimise Nix store disk usage by combining duplicate files:
- Search for a package in nixpkgs via its name or description:
`nix store optimise`
`nix search nixpkgs {{search_term}}`
- Start a shell with the specified packages from nixpkgs available:
`nix shell {{nixpkgs#pkg1 nixpkgs#pkg2 nixpkgs#pkg3 ...}}`
- Install some packages from nixpkgs permanently:
`nix profile install {{nixpkgs#pkg1 nixpkgs#pkg2 nixpkgs#pkg3 ...}}`
- Remove unused paths from Nix store to free up space:
`nix store gc`
- Start an interactive environment for evaluating Nix expressions:
`nix repl`
- Upgrade Nix to the latest stable version:
`nix upgrade-nix`