lib/salt-support/expand-template: fix for nix/pkgs/ap.sh

This commit is contained in:
Astro 2021-06-16 14:02:44 +02:00
parent 0cdef19a7c
commit a896652436
1 changed files with 9 additions and 1 deletions

View File

@ -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
''