From ffa6317a54f3f83067f1c07fbe0205c2c6affa37 Mon Sep 17 00:00:00 2001 From: Morgan Erlich Date: Fri, 1 Jan 2021 17:12:38 -0500 Subject: [PATCH] nix-shell, nix-env: add page and fix manual link (#5060) --- pages/common/nix-env.md | 2 +- pages/common/nix-shell.md | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 pages/common/nix-shell.md diff --git a/pages/common/nix-env.md b/pages/common/nix-env.md index df5c2b5b6..7dfabf73f 100644 --- a/pages/common/nix-env.md +++ b/pages/common/nix-env.md @@ -1,7 +1,7 @@ # nix-env > Manipulate or query Nix user environments. -> More information: . +> More information: . - List all installed packages: diff --git a/pages/common/nix-shell.md b/pages/common/nix-shell.md new file mode 100644 index 000000000..f565a33ca --- /dev/null +++ b/pages/common/nix-shell.md @@ -0,0 +1,28 @@ +# nix-shell + +> Start an interactive shell based on a Nix expression. +> More information: . + +- Start with nix expression in `shell.nix` or `default.nix` in the current directory: + +`nix-shell` + +- Run shell command in non-interactive shell and exit: + +`nix-shell --run "{{command}} {{command_arguments}}"` + +- Start with expression in `default.nix` in the current directory: + +`nix-shell {{default.nix}}` + +- Start with packages loaded from nixpkgs: + +`nix-shell --packages {{package_name_1}} {{package_name_2}}` + +- Start with packages loaded from specific nixpkgs revision: + +`nix-shell --packages {{package_names}} -I nixpkgs={{https://github.com/NixOS/nixpkgs/archive/nixpkgs_revision.tar.gz}}` + +- Evaluate rest of file in specific interpreter, for use in `#!-scripts` (see ): + +`nix-shell -i {{interpreter}} --packages {{package_names}}`