From 92939a935091dbaab491556c62aa74f197ad374e Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar <3998+srid@users.noreply.github.com> Date: Thu, 19 Sep 2024 15:08:24 -0400 Subject: [PATCH] nix: Add `om init` template params --- nix/modules/template.nix | 48 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/nix/modules/template.nix b/nix/modules/template.nix index 23bae52..96c876d 100644 --- a/nix/modules/template.nix +++ b/nix/modules/template.nix @@ -1,8 +1,50 @@ { inputs, ... }: { - flake.templates.default = { - description = "A batteries-included Rust project template for Nix"; - path = builtins.path { path = inputs.self; }; + flake = rec { + templates.default = { + description = "A batteries-included Rust project template for Nix"; + path = builtins.path { path = inputs.self; }; + }; + + # https://omnix.page/om/init.html#spec + om.templates.rust-nix-template = { + template = templates.default; + params = [ + { + name = "package-name"; + description = "Name of the Rust package"; + placeholder = "rust-nix-template"; + } + { + name = "author"; + description = "Author name"; + placeholder = "Sridhar Ratnakumar"; + } + { + name = "author-email"; + description = "Author email"; + placeholder = "srid@srid.ca"; + } + { + name = "vscode"; + description = "Include the VSCode settings folder (./.vscode)"; + paths = [ ".vscode" ]; + value = true; + } + { + name = "github-ci"; + description = "Include GitHub Actions workflow configuration"; + paths = [ ".github" ]; + value = true; + } + { + name = "nix-template"; + description = "Keep the flake template in the project"; + paths = [ "**/template.nix" ]; + value = false; + } + ]; + }; }; }