nix-flake-init
Create a flake in the current directory from a template
TLDR
SYNOPSIS
nix flake init [-t template] [flags]
DESCRIPTION
nix flake init creates a new `flake.nix` in the current directory by copying the files from a template flake. It will not overwrite existing files.The default template source is the `nixpkgs` flakes template registry. Templates are identified by a flake reference plus an optional attribute path (e.g. `templates#python`). After initialization, any `welcomeText` defined in the template is printed to the terminal.
PARAMETERS
-t, --template FLAKE
The template to use. Defaults to `templates#templates.default`. The template is a flake reference optionally followed by `#<attr>` to select a specific template attribute.
CAVEATS
Will not overwrite existing files. Nix flakes must be enabled in the Nix configuration (`experimental-features = nix-command flakes`).
HISTORY
Nix flakes were introduced as an experimental feature in Nix 2.4 (2021) to provide reproducible, composable builds. The `nix flake init` subcommand is part of the new-style `nix` CLI (`nix3`).
SEE ALSO
nix-flake(1), nix-flake-show(1), nix(1)
