Forrest logo
back to the nix-shell tool

nix-shell:tldr:42f88

nix-shell: Start with packages loaded from specific nixpkgs revision.
$ nix-shell --packages ${package_name_1 package_name_2 ---} -I nixpkgs=${https:--github-com-NixOS-nixpkgs-archive-nixpkgs_revision-tar-gz}
try on your machine

This command is used to start a new shell with specific packages installed using the Nix package manager. Let's break down the command step by step:

  • nix-shell: This is the command itself to start a new shell environment.

  • --packages: This option is used to specify the packages that should be installed in the new shell. You need to provide the names of the packages you want to install. In this case, the placeholder ${package_name_1 package_name_2 ---} suggests that you need to replace it with actual package names. For example, if you want to install both "package1" and "package2", you would replace it as "package1 package2".

  • -I nixpkgs=${https:--github-com-NixOS-nixpkgs-archive-nixpkgs_revision-tar-gz}: This option is used to specify the location of the Nix packages. The -I flag is used to set an override on the Nix search path, and in this case, it specifies that the nixpkgs package set should be loaded from a specific URL. The URL itself points to the Nixpkgs repository on GitHub.

Overall, this command starts a new shell environment where specific packages are installed, and it uses a specific Nixpkgs package set from a URL.

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