1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-22 12:42:07 +02:00
tldr/pages/common/nix3-shell.md
Alexander Bantyev 1ca4896e3b
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>
2023-04-26 14:15:00 +05:30

857 B

nix shell

Start a shell in which the specified packages are available. See also: tldr nix-shell. See tldr nix3 flake for information about flakes. More information: https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-shell.html.

  • Start an interactive shell with some packages from nixpkgs:

nix shell {{nixpkgs#pkg1 nixpkgs#packageSet.pkg2 ...}}

  • Start a shell providing a package from an older version of nixpkgs (21.05):

nix shell {{nixpkgs/nixos-21.05#pkg}}

  • Start a shell with the "default package" from a flake in the current directory, printing build logs if any builds happen:

nix shell -L

  • Start a shell with a package from a flake on GitHub:

nix shell {{github:owner/repo#pkg}}

  • Run a command in a shell with a package:

nix shell {{nixpkgs#pkg}} -c {{some-cmd --someflag 'Some other arguments'}}