Forrest logo
back to the nix-shell tool

nix-shell:tldr:d5180

nix-shell: Start with packages loaded from nixpkgs.
$ nix-shell --packages ${package_name_1 package_name_2 ---}
try on your machine

The command nix-shell --packages ${package_name_1 package_name_2 ---} is used to launch a Nix shell environment with specified packages installed.

Here's a breakdown of the command:

  • nix-shell: This is the command used to create an isolated development environment using Nix, a purely functional package manager. It provides a shell with all the dependencies and packages required by a project.

  • --packages: This option is used to specify the packages to be installed in the shell environment. You need to replace ${package_name_1 package_name_2 ---} with the actual package names you want to install. Multiple package names can be specified, separated by spaces.

For example, if you want to create a shell environment with the packages pkg1 and pkg2 installed, the command would be: nix-shell --packages pkg1 pkg2. This command would launch a new shell environment where pkg1 and pkg2 are available for use.

Note that the --- after specifying the package names is not a placeholder; it is just used to indicate the end of package names in cases where additional command-line options or arguments might follow.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the nix-shell tool