From a8acaf7143572dac1bc02b124e593d68b5bdddc7 Mon Sep 17 00:00:00 2001 From: asimon Date: Sun, 25 Jan 2026 12:15:49 +0100 Subject: [PATCH 1/4] fix(generator): replace gotmpl with gomplate --- README.md | 2 +- docs/index.md | 4 ++-- docs/usage.md | 4 ++-- lib/lib.nix | 2 +- lib/module.nix | 2 +- tests/fixtures/{gotmpl_template => gomplate_template} | 0 tests/soonix_test.nix | 10 +++++----- 7 files changed, 12 insertions(+), 12 deletions(-) rename tests/fixtures/{gotmpl_template => gomplate_template} (100%) diff --git a/README.md b/README.md index d46cb7c..4f95e22 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ use the `devshellModule` for easy integration, see the docs for more. - **`nix`**: Convert Nix data to JSON, YAML, TOML, INI, XML formats - **`string`**: Output raw string content with optional executable permissions - **`derivation`**: Use existing Nix derivations as file content -- **`gotmpl`**: Advanced Go template rendering via gomplate +- **`gomplate`**: Advanced Go template rendering via gomplate - **`jinja`**: Python Jinja2 template rendering ## Docs diff --git a/docs/index.md b/docs/index.md index b457a50..5d45fe9 100644 --- a/docs/index.md +++ b/docs/index.md @@ -19,7 +19,7 @@ Soonix helps you: - **nix**: Convert Nix data to JSON, YAML, TOML, INI, XML formats - **string**: Output raw string content with optional executable permissions - **derivation**: Use existing Nix derivations as file content -- **gotmpl**: Advanced Go template rendering via gomplate +- **gomplate**: Advanced Go template rendering via gomplate - **jinja**: Python Jinja2 template rendering ### Automatic File Management @@ -63,7 +63,7 @@ Automatically manage .gitignore entries for generated files to keep your reposit dockerfile = { output = "Dockerfile"; - generator = "gotmpl"; + generator = "gomplate"; data = { baseImage = "node:18-alpine"; port = 3000; diff --git a/docs/usage.md b/docs/usage.md index 2153ab2..7a02190 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -100,7 +100,7 @@ Use Go templates for more complex file generation: hooks = { dockerfile = { output = "Dockerfile"; - generator = "gotmpl"; + generator = "gomplate"; data = { baseImage = "node:18-alpine"; workdir = "/app"; @@ -331,7 +331,7 @@ in { hooks = { kubernetes-manifest = { output = "k8s/deployment.yaml"; - generator = "gotmpl"; + generator = "gomplate"; data = { app = { name = "my-app"; diff --git a/lib/lib.nix b/lib/lib.nix index cf82725..8bcfff9 100644 --- a/lib/lib.nix +++ b/lib/lib.nix @@ -50,7 +50,7 @@ # only a passthru derivation = {data, ...}: data; - gotmpl = { + gomplate = { name, opts, data, diff --git a/lib/module.nix b/lib/module.nix index 4546319..53017d9 100644 --- a/lib/module.nix +++ b/lib/module.nix @@ -30,7 +30,7 @@ in { }; generator = mkOption { - type = types.enum ["nix" "string" "derivation" "gotmpl" "jinja" "template"]; + type = types.enum ["nix" "string" "derivation" "gomplate" "jinja" "template"]; description = '' Which engine to use for content generation. ''; diff --git a/tests/fixtures/gotmpl_template b/tests/fixtures/gomplate_template similarity index 100% rename from tests/fixtures/gotmpl_template rename to tests/fixtures/gomplate_template diff --git a/tests/soonix_test.nix b/tests/soonix_test.nix index e59498e..8198e4b 100644 --- a/tests/soonix_test.nix +++ b/tests/soonix_test.nix @@ -19,10 +19,10 @@ }; }; gomplate = { - output = "gotmpl"; - generator = "gotmpl"; + output = "gomplate"; + generator = "gomplate"; data.hello = "world"; - opts.template = ./fixtures/gotmpl_template; + opts.template = ./fixtures/gomplate_template; }; jinja = { output = "jinja"; @@ -48,8 +48,8 @@ in { assert "-f ${finalFiles}/out/test.json" "should exist" assert_file_contains ${finalFiles}/out/test.json "soonix-test" - assert "-f ${finalFiles}/gotmpl" "should exist" - assert_file_contains ${finalFiles}/gotmpl "Hello world" + assert "-f ${finalFiles}/gomplate" "should exist" + assert_file_contains ${finalFiles}/gomplate "Hello world" assert "-f ${finalFiles}/jinja" "should exist" assert_file_contains ${finalFiles}/jinja "Hello world" From 26e79ede19e815a619a3878ffd5fa6b757da50c4 Mon Sep 17 00:00:00 2001 From: asimon Date: Sun, 25 Jan 2026 12:10:27 +0100 Subject: [PATCH 2/4] feat(generator): add Mustache --- README.md | 1 + docs/index.md | 1 + lib/lib.nix | 15 +++++++++++++++ lib/module.nix | 2 +- tests/fixtures/mustache_template | 1 + tests/soonix_test.nix | 9 +++++++++ 6 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 tests/fixtures/mustache_template diff --git a/README.md b/README.md index 4f95e22..68c2747 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ use the `devshellModule` for easy integration, see the docs for more. - **`derivation`**: Use existing Nix derivations as file content - **`gomplate`**: Advanced Go template rendering via gomplate - **`jinja`**: Python Jinja2 template rendering +- **`mustache`**: Mustache template rendering ## Docs diff --git a/docs/index.md b/docs/index.md index 5d45fe9..7576c2f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -21,6 +21,7 @@ Soonix helps you: - **derivation**: Use existing Nix derivations as file content - **gomplate**: Advanced Go template rendering via gomplate - **jinja**: Python Jinja2 template rendering +- **mustache**: Mustache template rendering ### Automatic File Management diff --git a/lib/lib.nix b/lib/lib.nix index 8bcfff9..3e6005d 100644 --- a/lib/lib.nix +++ b/lib/lib.nix @@ -100,6 +100,21 @@ } '' python ${renderScript} > $out ''; + + mustache = { + name, + opts, + data, + }: let + inherit (opts) template; + mustache = opts.mustache or pkgs.mustache-go; + dataJson = writeText "template-data.json" (builtins.toJSON data); + in + runCommand name { + buildInputs = [mustache]; + } '' + mustache ${dataJson} ${template} > $out + ''; }; buildAllFiles = files: diff --git a/lib/module.nix b/lib/module.nix index 53017d9..98400e3 100644 --- a/lib/module.nix +++ b/lib/module.nix @@ -30,7 +30,7 @@ in { }; generator = mkOption { - type = types.enum ["nix" "string" "derivation" "gomplate" "jinja" "template"]; + type = types.enum ["nix" "string" "derivation" "gomplate" "jinja" "mustache" "template"]; description = '' Which engine to use for content generation. ''; diff --git a/tests/fixtures/mustache_template b/tests/fixtures/mustache_template new file mode 100644 index 0000000..a4d8ee1 --- /dev/null +++ b/tests/fixtures/mustache_template @@ -0,0 +1 @@ +Hello {{hello}} diff --git a/tests/soonix_test.nix b/tests/soonix_test.nix index 8198e4b..0cfa1b8 100644 --- a/tests/soonix_test.nix +++ b/tests/soonix_test.nix @@ -30,6 +30,12 @@ data.hello = "world"; opts.template = ./fixtures/jinja_template; }; + mustache = { + output = "mustache"; + generator = "mustache"; + data.hello = "world"; + opts.template = ./fixtures/mustache_template; + }; }; in { suites."Soonix Tests" = { @@ -53,6 +59,9 @@ in { assert "-f ${finalFiles}/jinja" "should exist" assert_file_contains ${finalFiles}/jinja "Hello world" + + assert "-f ${finalFiles}/mustache" "should exist" + assert_file_contains ${finalFiles}/mustache "Hello world" ''; } { From 481b9c4a38455ba6d8502029894f9223ab2545d5 Mon Sep 17 00:00:00 2001 From: technofab Date: Wed, 28 Jan 2026 14:40:22 +0100 Subject: [PATCH 3/4] chore(module): remove "template" generator type --- lib/module.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/module.nix b/lib/module.nix index 98400e3..91ac9ba 100644 --- a/lib/module.nix +++ b/lib/module.nix @@ -30,7 +30,7 @@ in { }; generator = mkOption { - type = types.enum ["nix" "string" "derivation" "gomplate" "jinja" "mustache" "template"]; + type = types.enum ["nix" "string" "derivation" "gomplate" "jinja" "mustache"]; description = '' Which engine to use for content generation. ''; From 19a88a0c2681bbc85bc2cbe4f2860316d50fe957 Mon Sep 17 00:00:00 2001 From: technofab Date: Wed, 28 Jan 2026 14:40:58 +0100 Subject: [PATCH 4/4] chore(version): v0.2.0 --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e56069d..c239358 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines. - - - +## [v0.2.0](https://gitlab.com/TECHNOFAB/soonix/compare/a8acaf7143572dac1bc02b124e593d68b5bdddc7..v0.2.0) - 2026-01-28 +#### Features +- (**generator**) add Mustache - ([26e79ed](https://gitlab.com/TECHNOFAB/soonix/commit/26e79ede19e815a619a3878ffd5fa6b757da50c4)) - asimon +#### Bug Fixes +- (**generator**) replace gotmpl with gomplate - ([a8acaf7](https://gitlab.com/TECHNOFAB/soonix/commit/a8acaf7143572dac1bc02b124e593d68b5bdddc7)) - asimon +#### Miscellaneous Chores +- (**module**) remove "template" generator type - ([481b9c4](https://gitlab.com/TECHNOFAB/soonix/commit/481b9c4a38455ba6d8502029894f9223ab2545d5)) - [@TECHNOFAB](https://gitlab.com/TECHNOFAB) + +- - - + ## [v0.1.0](https://gitlab.com/TECHNOFAB/soonix/compare/25cc087b1da8dda965d47283c120a726b84ad6cf..v0.1.0) - 2026-01-05 #### Features - add nice to have `devshellModule` to soonix module for easy import - ([add807e](https://gitlab.com/TECHNOFAB/soonix/commit/add807ef8980197bbd06652a36d937b93b2a31c7)) - [@TECHNOFAB](https://gitlab.com/TECHNOFAB)