network/nix/lib/config/salt-support/load-yaml.nix

18 lines
334 B
Nix

{ pkgs ? import <nixpkgs> {}
}:
path:
let
json = pkgs.runCommandLocal "desalinated-${builtins.baseNameOf path}" {
nativeBuildInputs = with pkgs; [
pythonPackages.j2cli ruby yaml2json
];
} ''
j2 ${path} > expanded.yaml
yaml2json < expanded.yaml > $out
'';
in
builtins.fromJSON (
builtins.readFile json
)