1{
2 lib,
3 newScope,
4 json-schema-catalog-rs,
5 jsonschema-cli,
6}:
7let
8 inherit (lib) concatMapAttrs optionalAttrs;
9 inherit (lib.strings) hasSuffix removeSuffix;
10
11 jsonSchemaCatalogs = lib.makeScope newScope (
12 self:
13 {
14 inherit ((self.callPackage ./lib.nix { }).lib) newCatalog;
15 tests = self.callPackage ./tests.nix { };
16 }
17 // concatMapAttrs (
18 k: v:
19 optionalAttrs (v == "regular" && hasSuffix ".nix" k) {
20 ${removeSuffix ".nix" k} = self.callPackage (./catalogs + "/${k}") { };
21 }
22 ) (builtins.readDir ./catalogs)
23 );
24in
25{
26 # Exported to `pkgs`
27 inherit jsonSchemaCatalogs;
28}