mirror of
https://gitlab.com/TECHNOFAB/soonix.git
synced 2026-02-02 07:15:06 +01:00
Compare commits
No commits in common. "main" and "v0.1.0" have entirely different histories.
9 changed files with 12 additions and 49 deletions
10
CHANGELOG.md
10
CHANGELOG.md
|
|
@ -2,16 +2,6 @@
|
||||||
All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.
|
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
|
## [v0.1.0](https://gitlab.com/TECHNOFAB/soonix/compare/25cc087b1da8dda965d47283c120a726b84ad6cf..v0.1.0) - 2026-01-05
|
||||||
#### Features
|
#### 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)
|
- add nice to have `devshellModule` to soonix module for easy import - ([add807e](https://gitlab.com/TECHNOFAB/soonix/commit/add807ef8980197bbd06652a36d937b93b2a31c7)) - [@TECHNOFAB](https://gitlab.com/TECHNOFAB)
|
||||||
|
|
|
||||||
|
|
@ -53,9 +53,8 @@ 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
|
||||||
- **`mustache`**: Mustache template rendering
|
|
||||||
|
|
||||||
## Docs
|
## Docs
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,8 @@ 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
|
||||||
- **mustache**: Mustache template rendering
|
|
||||||
|
|
||||||
### Automatic File Management
|
### Automatic File Management
|
||||||
|
|
||||||
|
|
@ -64,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;
|
||||||
|
|
|
||||||
|
|
@ -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";
|
||||||
|
|
|
||||||
17
lib/lib.nix
17
lib/lib.nix
|
|
@ -50,7 +50,7 @@
|
||||||
# only a passthru
|
# only a passthru
|
||||||
derivation = {data, ...}: data;
|
derivation = {data, ...}: data;
|
||||||
|
|
||||||
gomplate = {
|
gotmpl = {
|
||||||
name,
|
name,
|
||||||
opts,
|
opts,
|
||||||
data,
|
data,
|
||||||
|
|
@ -100,21 +100,6 @@
|
||||||
} ''
|
} ''
|
||||||
python ${renderScript} > $out
|
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:
|
buildAllFiles = files:
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
generator = mkOption {
|
generator = mkOption {
|
||||||
type = types.enum ["nix" "string" "derivation" "gomplate" "jinja" "mustache"];
|
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.
|
||||||
'';
|
'';
|
||||||
|
|
|
||||||
1
tests/fixtures/mustache_template
vendored
1
tests/fixtures/mustache_template
vendored
|
|
@ -1 +0,0 @@
|
||||||
Hello {{hello}}
|
|
||||||
|
|
@ -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";
|
||||||
|
|
@ -30,12 +30,6 @@
|
||||||
data.hello = "world";
|
data.hello = "world";
|
||||||
opts.template = ./fixtures/jinja_template;
|
opts.template = ./fixtures/jinja_template;
|
||||||
};
|
};
|
||||||
mustache = {
|
|
||||||
output = "mustache";
|
|
||||||
generator = "mustache";
|
|
||||||
data.hello = "world";
|
|
||||||
opts.template = ./fixtures/mustache_template;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
suites."Soonix Tests" = {
|
suites."Soonix Tests" = {
|
||||||
|
|
@ -54,14 +48,11 @@ 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"
|
||||||
|
|
||||||
assert "-f ${finalFiles}/mustache" "should exist"
|
|
||||||
assert_file_contains ${finalFiles}/mustache "Hello world"
|
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue