nix3-flake-new(1) General Commands Manual nix3-flake-new(1)

Warning: This program is experimental and its interface is subject to change.

nix flake new - create a flake in the specified directory from a template

nix flake new [option…] dest-dir

Create a flake using the default template in the directory hello:
# nix flake new hello
List available templates:
# nix flake show templates
Create a flake from a specific template in the directory hello:
# nix flake new hello -t templates#trivial

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

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

--template / -t template
The template to use.

Common evaluation options:

  • --arg name expr
    Pass the value expr as the argument name to Nix functions.
  • --argstr name string
    Pass the string string as the argument name to Nix functions.
  • --eval-store store-url
    The Nix store to use for evaluations.
  • --impure
    Allow access to mutable paths and repositories.
  • --include / -I path
    Add path to the list of locations used to look up <...> file names.
  • --override-flake original-ref resolved-ref
    Override the flake registries, redirecting original-ref to resolved-ref.