2020-12-08 16:16:23 +00:00
|
|
|
R""(
|
|
|
|
|
|
|
|
# Examples
|
|
|
|
|
|
|
|
* Start a shell providing `youtube-dl` from the `nixpkgs` flake:
|
|
|
|
|
|
|
|
```console
|
|
|
|
# nix shell nixpkgs#youtube-dl
|
|
|
|
# youtube-dl --version
|
|
|
|
2020.11.01.1
|
|
|
|
```
|
|
|
|
|
|
|
|
* Start a shell providing GNU Hello from NixOS 20.03:
|
|
|
|
|
|
|
|
```console
|
|
|
|
# nix shell nixpkgs/nixos-20.03#hello
|
|
|
|
```
|
|
|
|
|
|
|
|
* Run GNU Hello:
|
|
|
|
|
|
|
|
```console
|
2023-04-30 13:55:08 +00:00
|
|
|
# nix shell nixpkgs#hello --command hello --greeting 'Hi everybody!'
|
2020-12-08 16:16:23 +00:00
|
|
|
Hi everybody!
|
|
|
|
```
|
|
|
|
|
2022-07-20 12:53:03 +00:00
|
|
|
* Run multiple commands in a shell environment:
|
|
|
|
|
|
|
|
```console
|
2023-04-30 13:55:08 +00:00
|
|
|
# nix shell nixpkgs#gnumake --command sh --command "cd src && make"
|
2022-07-20 12:53:03 +00:00
|
|
|
```
|
|
|
|
|
2020-12-08 16:16:23 +00:00
|
|
|
* Run GNU Hello in a chroot store:
|
|
|
|
|
|
|
|
```console
|
2023-04-30 13:55:08 +00:00
|
|
|
# nix shell --store ~/my-nix nixpkgs#hello --command hello
|
2020-12-08 16:16:23 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
* Start a shell providing GNU Hello in a chroot store:
|
|
|
|
|
|
|
|
```console
|
2023-04-30 13:55:08 +00:00
|
|
|
# nix shell --store ~/my-nix nixpkgs#hello nixpkgs#bashInteractive --command bash
|
2020-12-08 16:16:23 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
Note that it's necessary to specify `bash` explicitly because your
|
|
|
|
default shell (e.g. `/bin/bash`) generally will not exist in the
|
|
|
|
chroot.
|
|
|
|
|
|
|
|
# Description
|
|
|
|
|
2021-12-16 07:40:37 +00:00
|
|
|
`nix shell` runs a command in an environment in which the `$PATH` variable
|
2022-12-01 00:57:02 +00:00
|
|
|
provides the specified [*installables*](./nix.md#installable). If no command is specified, it starts the
|
2021-12-16 07:40:37 +00:00
|
|
|
default shell of your user account specified by `$SHELL`.
|
2020-12-08 16:16:23 +00:00
|
|
|
|
|
|
|
)""
|