31 lines
975 B
Nix
31 lines
975 B
Nix
std-passthru @ {
|
|
inputs,
|
|
cell,
|
|
}: let
|
|
yamlToJsonDrv = pkgs: yamlContent: outputPath: (pkgs.runCommand
|
|
outputPath
|
|
{
|
|
inherit yamlContent;
|
|
nativeBuildInputs = [pkgs.yq];
|
|
}
|
|
# 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
|
|
'');
|
|
|
|
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;
|
|
in {
|
|
fromYAML = yamlContent: builtins.fromJSON (builtins.readFile (yamlToJsonDrv inputs.nixpkgs yamlContent "fromYaml.json"));
|
|
ty = import ./ty.nix std-passthru;
|
|
deprecate = import ./mk-deprecate.nix std-passthru;
|
|
|
|
inherit tests;
|
|
exec-tests = exec_tests tests;
|
|
}
|