.\" -*- mode: troff; coding: utf-8 -*- .TH "nix3-flake-init" "1" "" .RS .PP \fBWarning\fR .br This program is \fB\fBexperimental\fR\fR and its interface is subject to change. .RE .SH Name .LP \f(CRnix flake init\fR - create a flake in the current directory from a template .SH Synopsis .LP \f(CRnix flake init\fR [\fIoption\fR\[u2026]] .SH Examples .IP "\(bu" 3 Create a flake using the default template: .LP .EX # nix flake init .EE .IP "\(bu" 3 List available templates: .LP .EX # nix flake show templates .EE .IP "\(bu" 3 Create a flake from a specific template: .LP .EX # nix flake init -t templates#simpleContainer .EE .SH Description .LP 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 \f(CRtemplates#templates.default\fR, but this can be overridden using \f(CR-t\fR. .SH Template definitions .LP A flake can declare templates through its \f(CRtemplates\fR output attribute. A template has the following attributes: .IP "\(bu" 3 \f(CRdescription\fR: A one-line description of the template, in CommonMark syntax. .IP "\(bu" 3 \f(CRpath\fR: The path of the directory to be copied. .IP "\(bu" 3 \f(CRwelcomeText\fR: A block of markdown text to display when a user initializes a new flake based on this template. .LP Here is an example: .LP .EX outputs = { self }: { templates.rust = { path = ./rust; description = \(dqA simple Rust/Cargo project\(dq; 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; } .EE .SH Options .IP "\(bu" 3 \fB\f(CR--template\fR\fR / \f(CR-t\fR \fItemplate\fR .IP The template to use. .SS Common evaluation options .IP "\(bu" 3 \fB\f(CR--arg\fR\fR \fIname\fR \fIexpr\fR .IP Pass the value \fIexpr\fR as the argument \fIname\fR to Nix functions. .IP "\(bu" 3 \fB\f(CR--arg-from-file\fR\fR \fIname\fR \fIpath\fR .IP Pass the contents of file \fIpath\fR as the argument \fIname\fR to Nix functions. .IP "\(bu" 3 \fB\f(CR--arg-from-stdin\fR\fR \fIname\fR .IP Pass the contents of stdin as the argument \fIname\fR to Nix functions. .IP "\(bu" 3 \fB\f(CR--argstr\fR\fR \fIname\fR \fIstring\fR .IP Pass the string \fIstring\fR as the argument \fIname\fR to Nix functions. .IP "\(bu" 3 \fB\f(CR--debugger\fR\fR .IP Start an interactive environment if evaluation fails. .IP "\(bu" 3 \fB\f(CR--eval-store\fR\fR \fIstore-url\fR .IP The \fBURL of the Nix store\fR to use for evaluation, i.e. to store derivations (\f(CR.drv\fR files) and inputs referenced by them. .IP "\(bu" 3 \fB\f(CR--impure\fR\fR .IP Allow access to mutable paths and repositories. .IP "\(bu" 3 \fB\f(CR--include\fR\fR / \f(CR-I\fR \fIpath\fR .IP Add \fIpath\fR to search path entries used to resolve \fBlookup paths\fR .IP This option may be given multiple times. .IP Paths added through \f(CR-I\fR take precedence over the \fB\f(CRnix-path\fR configuration setting\fR and the \fB\f(CRNIX_PATH\fR environment variable\fR. .IP "\(bu" 3 \fB\f(CR--override-flake\fR\fR \fIoriginal-ref\fR \fIresolved-ref\fR .IP Override the flake registries, redirecting \fIoriginal-ref\fR to \fIresolved-ref\fR. .SS Logging-related options .IP "\(bu" 3 \fB\f(CR--debug\fR\fR .IP Set the logging verbosity level to \(oqdebug\(cq. .IP "\(bu" 3 \fB\f(CR--log-format\fR\fR \fIformat\fR .IP Set the format of log output; one of \f(CRraw\fR, \f(CRinternal-json\fR, \f(CRbar\fR or \f(CRbar-with-logs\fR. .IP "\(bu" 3 \fB\f(CR--print-build-logs\fR\fR / \f(CR-L\fR .IP Print full build logs on standard error. .IP "\(bu" 3 \fB\f(CR--quiet\fR\fR .IP Decrease the logging verbosity level. .IP "\(bu" 3 \fB\f(CR--verbose\fR\fR / \f(CR-v\fR .IP Increase the logging verbosity level. .SS Miscellaneous global options .IP "\(bu" 3 \fB\f(CR--help\fR\fR .IP Show usage information. .IP "\(bu" 3 \fB\f(CR--offline\fR\fR .IP Disable substituters and consider all previously downloaded files up-to-date. .IP "\(bu" 3 \fB\f(CR--option\fR\fR \fIname\fR \fIvalue\fR .IP Set the Nix configuration setting \fIname\fR to \fIvalue\fR (overriding \f(CRnix.conf\fR). .IP "\(bu" 3 \fB\f(CR--refresh\fR\fR .IP Consider all previously downloaded files out-of-date. .IP "\(bu" 3 \fB\f(CR--repair\fR\fR .IP During evaluation, rewrite missing or corrupted files in the Nix store. During building, rebuild missing or corrupted store paths. .IP "\(bu" 3 \fB\f(CR--version\fR\fR .IP Show version information. .RS .LP \fBNote\fR .PP See \fB\f(CRman nix.conf\fR\fR for overriding configuration settings with command line flags. .RE