Compare commits

..

No commits in common. "7e3efd400c0a7bb5cd75229d58ad6084b4556866" and "5e479f3662db1c338679cdb3fd080cf06e4c67d4" have entirely different histories.

7 changed files with 12 additions and 12 deletions

View file

@ -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 - **`nix`**: Convert Nix data to JSON, YAML, TOML, INI, XML formats
- **`string`**: Output raw string content with optional executable permissions - **`string`**: Output raw string content with optional executable permissions
- **`derivation`**: Use existing Nix derivations as file content - **`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 - **`jinja`**: Python Jinja2 template rendering
## Docs ## Docs

View file

@ -19,7 +19,7 @@ Soonix helps you:
- **nix**: Convert Nix data to JSON, YAML, TOML, INI, XML formats - **nix**: Convert Nix data to JSON, YAML, TOML, INI, XML formats
- **string**: Output raw string content with optional executable permissions - **string**: Output raw string content with optional executable permissions
- **derivation**: Use existing Nix derivations as file content - **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 - **jinja**: Python Jinja2 template rendering
### Automatic File Management ### Automatic File Management
@ -63,7 +63,7 @@ Automatically manage .gitignore entries for generated files to keep your reposit
dockerfile = { dockerfile = {
output = "Dockerfile"; output = "Dockerfile";
generator = "gomplate"; generator = "gotmpl";
data = { data = {
baseImage = "node:18-alpine"; baseImage = "node:18-alpine";
port = 3000; port = 3000;

View file

@ -100,7 +100,7 @@ Use Go templates for more complex file generation:
hooks = { hooks = {
dockerfile = { dockerfile = {
output = "Dockerfile"; output = "Dockerfile";
generator = "gomplate"; generator = "gotmpl";
data = { data = {
baseImage = "node:18-alpine"; baseImage = "node:18-alpine";
workdir = "/app"; workdir = "/app";
@ -331,7 +331,7 @@ in {
hooks = { hooks = {
kubernetes-manifest = { kubernetes-manifest = {
output = "k8s/deployment.yaml"; output = "k8s/deployment.yaml";
generator = "gomplate"; generator = "gotmpl";
data = { data = {
app = { app = {
name = "my-app"; name = "my-app";

View file

@ -50,7 +50,7 @@
# only a passthru # only a passthru
derivation = {data, ...}: data; derivation = {data, ...}: data;
gomplate = { gotmpl = {
name, name,
opts, opts,
data, data,

View file

@ -30,7 +30,7 @@ in {
}; };
generator = mkOption { generator = mkOption {
type = types.enum ["nix" "string" "derivation" "gomplate" "jinja" "template"]; type = types.enum ["nix" "string" "derivation" "gotmpl" "jinja" "template"];
description = '' description = ''
Which engine to use for content generation. Which engine to use for content generation.
''; '';

View file

@ -19,10 +19,10 @@
}; };
}; };
gomplate = { gomplate = {
output = "gomplate"; output = "gotmpl";
generator = "gomplate"; generator = "gotmpl";
data.hello = "world"; data.hello = "world";
opts.template = ./fixtures/gomplate_template; opts.template = ./fixtures/gotmpl_template;
}; };
jinja = { jinja = {
output = "jinja"; output = "jinja";
@ -48,8 +48,8 @@ in {
assert "-f ${finalFiles}/out/test.json" "should exist" assert "-f ${finalFiles}/out/test.json" "should exist"
assert_file_contains ${finalFiles}/out/test.json "soonix-test" assert_file_contains ${finalFiles}/out/test.json "soonix-test"
assert "-f ${finalFiles}/gomplate" "should exist" assert "-f ${finalFiles}/gotmpl" "should exist"
assert_file_contains ${finalFiles}/gomplate "Hello world" assert_file_contains ${finalFiles}/gotmpl "Hello world"
assert "-f ${finalFiles}/jinja" "should exist" assert "-f ${finalFiles}/jinja" "should exist"
assert_file_contains ${finalFiles}/jinja "Hello world" assert_file_contains ${finalFiles}/jinja "Hello world"