2019-03-04 10:46:18 +00:00
# nix
2023-07-16 18:23:40 +01:00
> A powerful package manager that makes package management reliable, reproducible, and declarative.
> `nix` is experimental and requires enabling experimental features. For a classic, stable interface, see `tldr nix classic`.
2023-09-05 11:05:32 +01:00
> Some `nix` subcommands such as `build`, `develop`, `flake`, `registry`, `profile`, `search`, `repl`, `store`, `edit`, `why-depends`, etc. have their own usage documentation.
2023-04-26 09:45:00 +01:00
> More information: <https://nixos.org/manual/nix>.
2019-03-04 10:46:18 +00:00
2023-04-26 09:45:00 +01:00
- Enable the `nix` command:
2019-03-04 10:46:18 +00:00
2023-04-26 09:45:00 +01:00
`mkdir -p ~/.config/nix; echo 'experimental-features = nix-command flakes' > ~/.config/nix/nix.conf`
2019-03-04 10:46:18 +00:00
2023-04-26 09:45:00 +01:00
- Display help for the `nix` subcommand:
2019-03-04 10:46:18 +00:00
2023-04-26 09:45:00 +01:00
`nix help {{subcommand}}`
2019-03-04 10:46:18 +00:00
2023-04-26 09:45:00 +01:00
- Search for a package in nixpkgs via its name or description:
2019-03-04 10:46:18 +00:00
2023-04-26 09:45:00 +01:00
`nix search nixpkgs {{search_term}}`
2019-03-04 10:46:18 +00:00
2023-04-26 09:45:00 +01:00
- Start a shell with the specified packages from nixpkgs available:
2019-03-04 10:46:18 +00:00
2023-04-26 09:45:00 +01:00
`nix shell {{nixpkgs#pkg1 nixpkgs#pkg2 nixpkgs#pkg3 ...}}`
- Install some packages from nixpkgs permanently:
`nix profile install {{nixpkgs#pkg1 nixpkgs#pkg2 nixpkgs#pkg3 ...}}`
2019-03-04 10:46:18 +00:00
2023-04-26 09:45:00 +01:00
- Remove unused paths from Nix store to free up space:
2019-03-04 10:46:18 +00:00
2023-04-26 09:45:00 +01:00
`nix store gc`
- Start an interactive environment for evaluating Nix expressions:
`nix repl`