2023-06-18 09:51:33 +00:00
|
|
|
{
|
|
|
|
inputs,
|
|
|
|
cell,
|
|
|
|
}: let
|
2023-06-18 06:31:47 +00:00
|
|
|
namespace = "repo"; # ignore: unused
|
2023-06-16 23:12:54 +00:00
|
|
|
|
|
|
|
yamlToJsonDrv = pkgs: yamlContent: outputPath: (pkgs.runCommand
|
2023-06-18 03:32:15 +00:00
|
|
|
outputPath
|
2023-06-18 09:51:33 +00:00
|
|
|
{
|
|
|
|
inherit yamlContent;
|
|
|
|
nativeBuildInputs = [pkgs.yq];
|
|
|
|
}
|
2023-06-18 03:32:15 +00:00
|
|
|
# run yq which outputs '.' (no filter) on file at yamlPath
|
|
|
|
# note that $out is passed onto the bash/sh script for execution
|
|
|
|
''
|
|
|
|
echo "$yamlContent" | yq >$out
|
2023-06-18 06:31:47 +00:00
|
|
|
'');
|
2023-06-18 09:51:33 +00:00
|
|
|
in {
|
2023-06-18 06:31:47 +00:00
|
|
|
fromYAML = yamlContent: builtins.fromJSON (builtins.readFile (yamlToJsonDrv inputs.nixpkgs yamlContent "fromYaml.json"));
|
2023-06-16 23:12:54 +00:00
|
|
|
}
|