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