mirror of
https://gitlab.com/TECHNOFAB/soonix.git
synced 2026-02-02 15:25:05 +01:00
feat(generator): add Mustache
This commit is contained in:
parent
5e479f3662
commit
404d8cb782
6 changed files with 26 additions and 1 deletions
13
lib/lib.nix
13
lib/lib.nix
|
|
@ -100,6 +100,19 @@
|
|||
} ''
|
||||
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:
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ in {
|
|||
};
|
||||
|
||||
generator = mkOption {
|
||||
type = types.enum ["nix" "string" "derivation" "gotmpl" "jinja" "template"];
|
||||
type = types.enum ["nix" "string" "derivation" "gotmpl" "jinja" "mustache" "template"];
|
||||
description = ''
|
||||
Which engine to use for content generation.
|
||||
'';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue