From f3a2940e70dea2c35dcae3fca019e94bf8758b4d Mon Sep 17 00:00:00 2001 From: Taeer Bar-Yam Date: Tue, 15 Feb 2022 11:50:14 -0500 Subject: add descriptive output when creating templates this includes a `welcomeText` attribute which can be set in the template, as well as outputing which files were created. --- src/nix/flake-init.md | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/nix/flake-init.md') diff --git a/src/nix/flake-init.md b/src/nix/flake-init.md index 890038016..c8bcee375 100644 --- a/src/nix/flake-init.md +++ b/src/nix/flake-init.md @@ -37,6 +37,10 @@ A flake can declare templates through its `templates` and * `path`: The path of the directory to be copied. +* `welcomeText`: A block of text to display when a user initializes a new flake + based on this template. + + Here is an example: ``` @@ -45,6 +49,10 @@ outputs = { self }: { templates.rust = { path = ./rust; description = "A simple Rust/Cargo project"; + welcomeText = '' + You've created a simple Rust/Cargo template. + Visit https://www.rust-lang.org/ for more info. + ''; }; templates.defaultTemplate = self.templates.rust; -- cgit v1.2.3 From f56dd3a36bc8a325028588fd5500cbc33fa48a26 Mon Sep 17 00:00:00 2001 From: Taeer Bar-Yam Date: Thu, 17 Feb 2022 13:59:32 -0500 Subject: make flake template welcomeText markdown --- src/nix/flake-init.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/nix/flake-init.md') diff --git a/src/nix/flake-init.md b/src/nix/flake-init.md index c8bcee375..c13b22248 100644 --- a/src/nix/flake-init.md +++ b/src/nix/flake-init.md @@ -37,8 +37,8 @@ A flake can declare templates through its `templates` and * `path`: The path of the directory to be copied. -* `welcomeText`: A block of text to display when a user initializes a new flake - based on this template. +* `welcomeText`: A block of markdown text to display when a user initializes a + new flake based on this template. Here is an example: @@ -50,8 +50,14 @@ outputs = { self }: { path = ./rust; description = "A simple Rust/Cargo project"; welcomeText = '' - You've created a simple Rust/Cargo template. - Visit https://www.rust-lang.org/ for more info. + # 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) + - ... ''; }; -- cgit v1.2.3 From 1a6548ca757f81594f5b54d8dada4c5ba65821de Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 22 Feb 2022 14:32:56 +0100 Subject: Update docs --- src/nix/flake-init.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/nix/flake-init.md') diff --git a/src/nix/flake-init.md b/src/nix/flake-init.md index c13b22248..fc1f4f805 100644 --- a/src/nix/flake-init.md +++ b/src/nix/flake-init.md @@ -24,13 +24,13 @@ R""( 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 overridden +template is `templates#templates.default`, but this can be overridden using `-t`. # Template definitions -A flake can declare templates through its `templates` and -`defaultTemplate` output attributes. A template has two attributes: +A flake can declare templates through its `templates` output +attribute. A template has two attributes: * `description`: A one-line description of the template, in CommonMark syntax. @@ -61,7 +61,7 @@ outputs = { self }: { ''; }; - templates.defaultTemplate = self.templates.rust; + templates.default = self.templates.rust; } ``` -- cgit v1.2.3