nix3-flake-init(1) | General Commands Manual | nix3-flake-init(1) |
Warning: This program is experimental and its interface is subject to change.
nix flake init - create a flake in the current directory from a template
nix flake init [option…]
# nix flake init
# nix flake show templates
# nix flake init -t templates#simpleContainer
This command creates a flake in the current directory by copying the files of a template. It will not overwrite existing files. The default template is templates#templates.default, but this can be overridden using -t.
A flake can declare templates through its templates output attribute. A template has two attributes:
Here is an example:
outputs = { self }: {
templates.rust = {
path = ./rust;
description = "A simple Rust/Cargo project";
welcomeText = ''
# Simple Rust/Cargo Template
## Intended usage
The intended usage of this flake is...
## More info
- [Rust language](https://www.rust-lang.org/)
- [Rust on the NixOS Wiki](https://nixos.wiki/wiki/Rust)
- ...
'';
};
templates.default = self.templates.rust; }
Common evaluation options: