mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-01-26 11:33:59 +00:00
34 lines
849 B
Plaintext
34 lines
849 B
Plaintext
---
|
|
syntax: markdown
|
|
tags: [tldr, common]
|
|
source: https://github.com/tldr-pages/tldr.git
|
|
---
|
|
# nix eval
|
|
|
|
> Evaluate a Nix expression and print the result to `stdout`.
|
|
> More information: <https://nix.dev/manual/nix/stable/command-ref/new-cli/nix3-eval.html>.
|
|
|
|
- Evaluate Nix flake attributes in the current directory:
|
|
|
|
`nix eval .#{{attributes}}`
|
|
|
|
- Evaluate a given Nix expression:
|
|
|
|
`nix eval --expr '{{your_expression}}'`
|
|
|
|
- Evaluate a Nix expression from a specified file:
|
|
|
|
`nix eval --file {{path/to/file}}`
|
|
|
|
- Print the store path of the specified package from nixpkgs:
|
|
|
|
`nix eval {{nixpkgs#pkg}} --raw`
|
|
|
|
- Evaluate attributes from a flake directly from GitHub:
|
|
|
|
`nix eval {{github:owner/repo#attributes}}`
|
|
|
|
- Evaluate a given lambda function passing the specified package as argument:
|
|
|
|
`nix eval {{nixpkgs#pkg}} --apply '{{lambda_function}}'`
|