diff --git a/README.md b/README.md index 68c2747..a6da20f 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 -- **`gomplate`**: Advanced Go template rendering via gomplate +- **`gotmpl`**: Advanced Go template rendering via gomplate - **`jinja`**: Python Jinja2 template rendering - **`mustache`**: Mustache template rendering diff --git a/docs/index.md b/docs/index.md index 7576c2f..61c3051 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 -- **gomplate**: Advanced Go template rendering via gomplate +- **gotmpl**: Advanced Go template rendering via gomplate - **jinja**: Python Jinja2 template rendering - **mustache**: Mustache template rendering @@ -64,7 +64,7 @@ Automatically manage .gitignore entries for generated files to keep your reposit dockerfile = { output = "Dockerfile"; - generator = "gomplate"; + generator = "gotmpl"; data = { baseImage = "node:18-alpine"; port = 3000; diff --git a/docs/usage.md b/docs/usage.md index 7a02190..2153ab2 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 = "gomplate"; + generator = "gotmpl"; data = { baseImage = "node:18-alpine"; workdir = "/app"; @@ -331,7 +331,7 @@ in { hooks = { kubernetes-manifest = { output = "k8s/deployment.yaml"; - generator = "gomplate"; + generator = "gotmpl"; data = { app = { name = "my-app"; diff --git a/lib/lib.nix b/lib/lib.nix index 3e6005d..1851571 100644 --- a/lib/lib.nix +++ b/lib/lib.nix @@ -50,7 +50,7 @@ # only a passthru derivation = {data, ...}: data; - gomplate = { + gotmpl = { name, opts, data, @@ -112,9 +112,7 @@ in runCommand name { buildInputs = [mustache]; - } '' - mustache ${dataJson} ${template} > $out - ''; + } "mustache ${dataJson} ${template} > $out"; }; buildAllFiles = files: diff --git a/lib/module.nix b/lib/module.nix index 98400e3..4c76a8d 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" "gotmpl" "jinja" "mustache" "template"]; description = '' Which engine to use for content generation. ''; diff --git a/tests/fixtures/gomplate_template b/tests/fixtures/gotmpl_template similarity index 100% rename from tests/fixtures/gomplate_template rename to tests/fixtures/gotmpl_template diff --git a/tests/soonix_test.nix b/tests/soonix_test.nix index 0cfa1b8..108cbc0 100644 --- a/tests/soonix_test.nix +++ b/tests/soonix_test.nix @@ -19,10 +19,10 @@ }; }; gomplate = { - output = "gomplate"; - generator = "gomplate"; + output = "gotmpl"; + generator = "gotmpl"; data.hello = "world"; - opts.template = ./fixtures/gomplate_template; + opts.template = ./fixtures/gotmpl_template; }; jinja = { output = "jinja"; @@ -54,8 +54,8 @@ in { assert "-f ${finalFiles}/out/test.json" "should exist" assert_file_contains ${finalFiles}/out/test.json "soonix-test" - assert "-f ${finalFiles}/gomplate" "should exist" - assert_file_contains ${finalFiles}/gomplate "Hello world" + assert "-f ${finalFiles}/gotmpl" "should exist" + assert_file_contains ${finalFiles}/gotmpl "Hello world" assert "-f ${finalFiles}/jinja" "should exist" assert_file_contains ${finalFiles}/jinja "Hello world"