Linux command
nix-shell.2 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Quick package shell
nix-shell -p [package]
Shell with multiple packages
nix-shell -p [git] [curl] [jq]
Execute and exit
nix-shell -p [ripgrep] --run "rg pattern"
From expression
nix-shell -E "with import <nixpkgs> {}; mkShell { buildInputs = [hello]; }"
说明
nix-shell provides ad-hoc development environments. This is alternate documentation. The tool is essential for quick environment setup. No permanent changes.
参数
- -p _PKG_
- Add package to shell.
- --run _CMD_
- Run command and exit.
- -E _EXPR_
- Evaluate expression.
- --help
- Display help information.
FAQ
What is the nix-shell.2 command used for?
nix-shell provides ad-hoc development environments. This is alternate documentation. The tool is essential for quick environment setup. No permanent changes.
How do I run a basic nix-shell.2 example?
Run `nix-shell -p [package]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -p _PKG_ do in nix-shell.2?
Add package to shell.