Home Explore Blog Models CI



nix

src/nix/flake-new.md
fe0ab8885ba3e109c01cd54990b119baa03addf486f1bb1d0000000300000219
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
```

)""

Chunks
531c6dc9 (1st chunk of `src/nix/flake-new.md`)
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`).