Home Explore Blog Models CI



nix

1st chunk of `src/nix/flake-new.md`
531c6dc94c4b7978a6fb7b50e9e87adb8707dd87ea94f8c60000000100000219
R""(

# Examples

* Create a flake using the default template in the directory `hello`:

  ```console
  # nix flake new hello
  ```

* List available templates:

  ```console
  # nix flake show templates
  ```

* Create a flake from a specific template in the directory `hello`:

  ```console
  # nix flake new hello -t templates#trivial
  ```

# Description

This command creates a flake in the directory `dest-dir`, which must
not already exist. It's equivalent to:

```console
# mkdir dest-dir
# cd dest-dir
# nix flake init
```

)""

Title: `nix flake new` Command: Examples and Description
Summary
The `nix flake new` command is used to create a new Nix flake in a specified directory, which must not already exist. This operation is functionally equivalent to creating the directory, changing into it, and then running `nix flake init`. The provided examples demonstrate how to create a flake using the default template, list available templates, and create a flake from a specific template (e.g., `templates#trivial`).