pkgs: files: let test = import ./import.nix; res = map test files; resFile = builtins.toFile "results" (builtins.toJSON res); filter = '' .[] | { (.path): { failures: [.results | map(select(.success==false))[] | {(.msg): {actual, expected}}], success: .results | map(select(.success) | .msg) | length } } ''; in (pkgs.writeShellScriptBin "test" '' cat '${resFile}' | ${pkgs.jq}/bin/jq '${filter}' '')