Nix command/flake init

From NixOS Wiki
Jump to: navigation, search

This article is about the nix flake init subcommand.

Description

Create a flake in the current directory from a template.

Usage

$ nix flake init FLAGS...

Flags

  • --arg NAME EXPR argument to be passed to Nix functions
  • --argstr NAME STRING string-valued argument to be passed to Nix functions
  • --impure allow access to mutable paths and repositories
  • -I, --include PATH add a path to the list of locations used to look up <...> file names
  • --override-flake ORIGINAL-REF RESOLVED-REF override a flake registry value
  • -t, --template TEMPLATE the template to use

Examples

To create a flake using the default template:

$ nix flake init

To see available templates:

$ nix flake show templates

To create a flake from a specific template:

$ nix flake init -t templates#nixos-container

See also