diff --git a/pages/common/nix-eval.md b/pages/common/nix-eval.md new file mode 100644 index 0000000000..793971e4ef --- /dev/null +++ b/pages/common/nix-eval.md @@ -0,0 +1,28 @@ +# nix eval + +> Evaluate a Nix expression and print the result to `stdout`. +> More information: . + +- 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}}'` diff --git a/pages/common/nix-flake-info.md b/pages/common/nix-flake-info.md new file mode 100644 index 0000000000..ca43f5e1d3 --- /dev/null +++ b/pages/common/nix-flake-info.md @@ -0,0 +1,16 @@ +# nix flake info + +> Show flake metadata. +> More information: . + +- 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` diff --git a/pages/common/nix-flake-init.md b/pages/common/nix-flake-init.md new file mode 100644 index 0000000000..3f3aee6a8c --- /dev/null +++ b/pages/common/nix-flake-init.md @@ -0,0 +1,12 @@ +# nix flake init + +> Create a flake in the current directory from a template. +> More information: . + +- 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}}` diff --git a/pages/common/nix-flake-show.md b/pages/common/nix-flake-show.md new file mode 100644 index 0000000000..d0b714eaa7 --- /dev/null +++ b/pages/common/nix-flake-show.md @@ -0,0 +1,20 @@ +# nix flake show + +> Show outputs provided by a flake. +> More information: . + +- 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` diff --git a/pages/common/nix-flake.md b/pages/common/nix-flake.md index c68efff225..7af85c0cb0 100644 --- a/pages/common/nix-flake.md +++ b/pages/common/nix-flake.md @@ -1,12 +1,9 @@ # nix flake > Manage Nix flakes. +> Some subcommands such as `init`, `show`, `info` have their own usage documentation. > More information: . -- 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: