nix-eval, nix-flake-{show, info, init}: add page (#20061)

Co-authored-by: Managor <42655600+Managor@users.noreply.github.com>
Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com>
Co-authored-by: Ivan Baluta <ivanbaluta.dev@gmail.com>
This commit is contained in:
mana-byte
2025-12-17 19:12:48 +01:00
committed by GitHub
parent 7e775f70ea
commit a7cb342b6f
5 changed files with 83 additions and 6 deletions
+28
View File
@@ -0,0 +1,28 @@
# 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}}'`
+16
View File
@@ -0,0 +1,16 @@
# nix flake info
> Show flake metadata.
> More information: <https://nix.dev/manual/nix/stable/command-ref/new-cli/nix3-flake-info>.
- Show flake metadata of the flake in the current directory:
`nix flake info`
- Show flake metadata from GitHub as a json on a single line:
`nix flake info {{github:owner/repo}} --json --no-pretty`
- Show flake metadata from Github as a multi-line indented json:
`nix flake info {{github:owner/repo}} --json --pretty`
+12
View File
@@ -0,0 +1,12 @@
# nix flake init
> Create a flake in the current directory from a template.
> More information: <https://nix.dev/manual/nix/stable/command-ref/new-cli/nix3-flake-init.html>.
- Create a new flake from the default template, in the current directory:
`nix flake init`
- Create a new flake with a specified template (see `nix flake show` for information about templates):
`nix flake init {{[-t|--template]}} templates#{{your_template}}`
+20
View File
@@ -0,0 +1,20 @@
# nix flake show
> Show outputs provided by a flake.
> More information: <https://nix.dev/manual/nix/stable/command-ref/new-cli/nix3-flake-show.html>.
- Show all the outputs of the flake in the current directory:
`nix flake show`
- Show all the outputs of a flake on GitHub and print the output as a json on a single line:
`nix flake show {{github:owner/repo}} --json --no-pretty`
- Show all the `legacyPackages` outputs of a flake on GitHub and print the output as a multi-line indented json:
`nix flake show {{github:owner/repo}} --json --pretty --legacy`
- List all available flake templates for `nix flake init`:
`nix flake show templates`
+7 -6
View File
@@ -1,12 +1,9 @@
# nix flake
> Manage Nix flakes.
> Some subcommands such as `init`, `show`, `info` have their own usage documentation.
> More information: <https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html>.
- Create a new flake (just the `flake.nix` file) from the default template, in the current directory:
`nix flake init`
- Update all inputs (dependencies) of the flake in the current directory:
`nix flake update`
@@ -15,9 +12,13 @@
`nix flake update {{input}}`
- Show all the outputs of a flake on github:
- Clone a GitHub repository containing a flake:
`nix flake show {{github:owner/repo}}`
`nix flake clone {{github:owner/repo#attributes}}`
- Create missing lock file entries for a flake in a specified directory:
`nix flake lock {{path/to/flake}}`
- Display help: