From a8966524366b34f1c9e414701588f70a23809453 Mon Sep 17 00:00:00 2001 From: Astro Date: Wed, 16 Jun 2021 14:02:44 +0200 Subject: [PATCH] lib/salt-support/expand-template: fix for nix/pkgs/ap.sh --- nix/lib/salt-support/expand-template.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 ''