diff --git a/nix/lib/salt-support/expand-template.nix b/nix/lib/salt-support/expand-template.nix index f3cf49b..ece5912 100644 --- a/nix/lib/salt-support/expand-template.nix +++ b/nix/lib/salt-support/expand-template.nix @@ -5,11 +5,19 @@ name: template: data: let jsonFile = builtins.toFile "data.json" (builtins.toJSON data); + j2custom = + builtins.toFile "j2custom.py" '' + def j2_environment(env): + env.globals.update( + zip=zip + ) + return env + ''; in pkgs.runCommandLocal name { nativeBuildInputs = with pkgs; [ pythonPackages.j2cli yaml2json ]; } '' - j2 -f json ${template} ${jsonFile} > $out + j2 --customize ${j2custom} -f json ${template} ${jsonFile} > $out ''