diff --git a/flake.nix b/flake.nix index f981955..b48310e 100644 --- a/flake.nix +++ b/flake.nix @@ -25,6 +25,7 @@ # Tests use flake to do packageSearch builds inherit (codedown) codedownSearcher; + allSettingsSchemas = pkgsStable.callPackage ./nix/all-settings-schemas.nix { inherit (sampleOutputs) sample_environments; }; # For .envrc nixpkgsPath = pkgsStable.writeShellScriptBin "nixpkgsPath.sh" "echo -n ${pkgsStable.path}"; @@ -39,15 +40,6 @@ } // sampleOutputs.inner ; - - checks = { - customScript = pkgsStable.writeShellScript "test-script" '' - #!/bin/sh - echo "Running custom test..." - # Add your test logic here - exit 0 - ''; - }; } ); } diff --git a/nix/all-settings-schemas.nix b/nix/all-settings-schemas.nix new file mode 100644 index 0000000..1ba22c6 --- /dev/null +++ b/nix/all-settings-schemas.nix @@ -0,0 +1,29 @@ +{ lib +, writeShellScript +, writeTextFile + +, sample_environments +}: + +let + all_settings_schemas = let + gatherSchemas = prefix: pkg: + (if !(lib.hasAttrByPath ["meta" "settings_schema"] pkg) then [] + else [{ name = prefix + pkg.name; value = pkg.meta.settings_schema; }]) + ++ builtins.concatLists (map (gatherSchemas (prefix + pkg.name + ".")) (pkg.packages or [])) + ; + + gatherSchemasFromEnvironment = prefix: env: + builtins.concatLists (lib.mapAttrsToList (n: v: gatherSchemas prefix v) env.ui_metadata.packages); + + in + lib.listToAttrs ( + builtins.concatLists (lib.mapAttrsToList (n: v: gatherSchemasFromEnvironment (n + ".") v) sample_environments) + ); + +in + +writeTextFile { + name = "all_settings_schemas.json"; + text = builtins.toJSON all_settings_schemas; +} diff --git a/nix/sample-outputs.nix b/nix/sample-outputs.nix index 5f16770..df8579e 100644 --- a/nix/sample-outputs.nix +++ b/nix/sample-outputs.nix @@ -32,28 +32,6 @@ in sample_environments ); - # TODO: add test that all settings schemas are valid in certain ways: - # - they all have a title - all_settings_schemas = let - gatherSchemas = prefix: pkg: - (if !(lib.hasAttrByPath ["meta" "settings_schema"] pkg) then [] - else [{ name = prefix + pkg.name; value = pkg.meta.settings_schema; }]) - ++ builtins.concatLists (map (gatherSchemas (prefix + pkg.name + ".")) (pkg.packages or [])) - ; - - gatherSchemasFromEnvironment = prefix: env: - builtins.concatLists (lib.mapAttrsToList (n: v: gatherSchemas prefix v) env.ui_metadata.packages); - - in - writeTextFile { - name = "all_settings_schemas.json"; - text = builtins.toJSON ( - lib.listToAttrs ( - builtins.concatLists (lib.mapAttrsToList (n: v: gatherSchemasFromEnvironment (n + ".") v) sample_environments) - ) - ); - }; - printVersions = let versionsMap = with lib; mapAttrs (lang: value: if (hasAttr "versions" value) then value.versions else {})