nix3-flake-init(1)
π nix3-flake-init(1) β from the General Commands Manual, bestie π
β οΈ Warning β οΈ This program is experimental and its interface is subject to change. So like... don't get too attached to the exact vibes, okay? The CLI might glow up differently next month. π
β¨ Name β¨
nix flake init β create a flake in the current directory from a template π¦
πΈ Synopsis πΈ
nix flake init [optionβ¦]
π Examples π
- Create a flake using the default template:
# nix flake init
- List available templates:
# nix flake show templates
- Create a flake from a specific template:
# nix flake init -t templates#simpleContainer
π Description π
This command creates a flake in the current directory by copying the files of a template. And no, it will not overwrite existing files β she's respectful like that, she would never stomp on your stuff. π
The default template is templates#templates.default, but you can override that with -t. Periodt. π
π§ Template definitions π§
A flake can declare templates through its templates output attribute. A template has these attributes, and they're lowkey iconic:
description: A one-line description of the template, in CommonMark syntax.path: The path of the directory to be copied.welcomeText: A block of markdown text to display when a user initializes a new flake based on this template.
Here is an example β look at her go:
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://wiki.nixos.org/wiki/Rust)
- ...
'';
};
templates.default = self.templates.rust;
}
β¨ Options β¨
--template,-ttemplate β The template to use. π
π Common evaluation options π
--argname expr β Pass the value expr as the argument name to Nix functions.--arg-from-filename path β Pass the contents of file path as the argument name to Nix functions.--arg-from-stdinname β Pass the contents of stdin as the argument name to Nix functions.--argstrname string β Pass the string string as the argument name to Nix functions.--debuggerβ Start an interactive environment if evaluation fails. She's got you, bestie. π«Ά--eval-storestore-url β The URL of the Nix store to use for evaluation, i.e. to store derivations (.drvfiles) and inputs referenced by them.--impureβ Allow access to mutable paths and repositories. Living dangerously, I see. π--include,-Ipath β Add path to search path entries used to resolve lookup paths- This option may be given multiple times.
- Paths added through
-Itake precedence over thenix-pathconfiguration setting and theNIX_PATHenvironment variable.
--override-flakeoriginal-ref resolved-ref β Override the flake registries, redirecting original-ref to resolved-ref.
π₯ Logging-related options π₯
--debugβ Set the logging verbosity level to βdebugβ.--log-formatformat β Set the format of log output; one ofraw,internal-json,barorbar-with-logs.--print-build-logs,-Lβ Print full build logs on standard error.--quietβ Decrease the logging verbosity level. π€«--verbose,-vβ Increase the logging verbosity level.
π Miscellaneous global options π
--helpβ Show usage information.--offlineβ Disable substituters and consider all previously downloaded files up-to-date.--optionname value β Set the Nix configuration setting name to value (overridingnix.conf).--refreshβ Consider all previously downloaded files out-of-date.--repairβ During evaluation, rewrite missing or corrupted files in the Nix store. During building, rebuild missing or corrupted store paths.--versionβ Show version information.
π Note β See man nix.conf for overriding configuration settings with command line flags.
And that's the whole page, bestie β you ate this. π β¨
Signing off from the nix3-flake-init(1) page of the General Commands Manual β sending you the biggest fairy-dust kiss from your favorite manual. π§ππβ π«Ά
π¦ where this page comes from
- fedora 44: nix-core 2.35.3-2.fc44 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms