aboutsummaryrefslogtreecommitdiff
path: root/src/nix/nix.md
diff options
context:
space:
mode:
authorQyriad <qyriad@qyriad.me>2024-04-29 08:15:52 -0600
committerQyriad <qyriad@qyriad.me>2024-04-29 08:18:00 -0600
commit6abeea70e9dac328159a9ba4d6f0d84c5c3a2387 (patch)
treeac0430c1efcf269404c440b657903981ad29cd95 /src/nix/nix.md
parentbd2619868c8e6f2f8a9724400f1ee9da0bcbb157 (diff)
docs: give translation examples from nix-build -E/-A to installables
Change-Id: I03f4c7c1049063539a35ba500a07bb8f866d4cb7
Diffstat (limited to 'src/nix/nix.md')
-rw-r--r--src/nix/nix.md12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/nix/nix.md b/src/nix/nix.md
index 7b2cd7b7b..65fe0c5b5 100644
--- a/src/nix/nix.md
+++ b/src/nix/nix.md
@@ -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