2023-10-21 18:26:31 +00:00
|
|
|
std-passthru @ {
|
2023-06-18 09:51:33 +00:00
|
|
|
inputs,
|
|
|
|
cell,
|
|
|
|
}: let
|
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-10-21 18:26:31 +00:00
|
|
|
|
|
|
|
exec_tests = testUnit: let
|
|
|
|
testNames = builtins.attrNames testUnit;
|
|
|
|
evaluateTest = testName: assert testUnit."${testName}" == true; testName;
|
|
|
|
in
|
|
|
|
builtins.concatStringsSep ", " (builtins.foldl' (acc: testName: acc ++ [(evaluateTest testName)]) [] testNames);
|
|
|
|
tests = import ./tests.nix std-passthru;
|
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-10-21 18:26:31 +00:00
|
|
|
ty = import ./ty.nix std-passthru;
|
|
|
|
deprecate = import ./mk-deprecate.nix std-passthru;
|
|
|
|
|
|
|
|
inherit tests;
|
|
|
|
exec-tests = exec_tests tests;
|
2023-06-16 23:12:54 +00:00
|
|
|
}
|