docs: give translation examples from nix-build -E/-A to installables

Change-Id: I03f4c7c1049063539a35ba500a07bb8f866d4cb7
This commit is contained in:
Qyriad 2024-04-29 08:15:52 -06:00
parent bd2619868c
commit 6abeea70e9

View file

@ -162,6 +162,12 @@ When the option `-f` / `--file` *path* \[*attrpath*...\] is given, installables
If attribute paths are provided, commands will operate on the corresponding values accessible at these paths.
The Nix expression in that file, or any selected attribute, must evaluate to a derivation.
To emulate the `nix-build '<nixpkgs>' -A hello` pattern, use:
```console
$ nix build -f '<nixpkgs>' hello
```
### Nix expression
Example: `--expr 'import <nixpkgs> {}' hello`
@ -172,6 +178,12 @@ The Nix expression, or any selected attribute, must evaluate to a derivation.
You may need to specify `--impure` if the expression references impure inputs (such as `<nixpkgs>`).
To emulate the `nix-build -E 'with import <nixpkgs> { }; hello' pattern use:
```console
$ nix build --impure -E 'with import <nixpkgs> { }; hello'
```
## Derivation output selection
Derivations can have multiple outputs, each corresponding to a