diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-12-23 13:19:53 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-12-23 18:26:40 +0100 |
commit | c9279b831e91a762851464826eaa8a8e30979578 (patch) | |
tree | 46c58403fcad3c2d5081457aa19e95b03becc6dd /src/nix/flake-init.md | |
parent | 16e34085e8f45758b97c41cfcd720552c68a3c98 (diff) |
Add 'nix flake' manpages
Diffstat (limited to 'src/nix/flake-init.md')
-rw-r--r-- | src/nix/flake-init.md | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/nix/flake-init.md b/src/nix/flake-init.md new file mode 100644 index 000000000..c66154ad5 --- /dev/null +++ b/src/nix/flake-init.md @@ -0,0 +1,54 @@ +R""( + +# Examples + +* Create a flake using the default template: + + ```console + # nix flake init + ``` + +* List available templates: + + ```console + # nix flake show templates + ``` + +* Create a flake from a specific template: + + ```console + # nix flake init -t templates#simpleContainer + ``` + +# Description + +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#defaultTemplate`, but this can be overriden +using `-t`. + +# Template definitions + +A flake can declare templates through its `templates` and +`defaultTemplate` output attributes. A template has two attributes: + +* `description`: A one-line description of the template, in CommonMark + syntax. + +* `path`: The path of the directory to be copied. + +Here is an example: + +``` +outputs = { self }: { + + templates.rust = { + path = ./rust; + description = "A simple Rust/Cargo project"; + }; + + templates.defaultTemplate = self.templates.rust; +} +``` + +)"" |