lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

jsonSchemaCatalogs: init

+300
+4
pkgs/by-name/js/json-schema-catalog-rs/package.nix
··· 1 1 { 2 2 callPackage, 3 3 fetchFromGitHub, 4 + jsonSchemaCatalogs, 4 5 lib, 5 6 nix-update-script, 6 7 rustPlatform, ··· 28 29 passthru = { 29 30 tests = { 30 31 run = callPackage ./test-run.nix { json-schema-catalog-rs = finalAttrs.finalPackage; }; 32 + jsonSchemaCatalogs = jsonSchemaCatalogs.tests.override { 33 + json-schema-catalog-rs = finalAttrs.finalPackage; 34 + }; 31 35 }; 32 36 33 37 updateScript = nix-update-script { };
+33
pkgs/data/json-schema/catalogs/json-patch-schemastore.nix
··· 1 + { 2 + fetchurl, 3 + lib, 4 + newCatalog, 5 + }: 6 + 7 + newCatalog { 8 + name = "json-patch-schemastore"; 9 + displayName = "JSON Patch as maintained by the https://www.schemastore.org community"; 10 + version = "2024-11-26"; 11 + groups = { 12 + "JSON Patch" = { 13 + "https://json.schemastore.org/json-patch.json" = fetchurl { 14 + name = "json-patch-schema"; 15 + # Note that we don't use the json.schemastore.org URLs directly, as those are mutable resources. 16 + # Make sure to update the version above! 17 + url = "https://github.com/schemastore/schemastore/raw/138439cd4f9d7bf57d6747b674ce5bbcffbfafdc/src/schemas/json/json-patch.json"; 18 + hash = "sha256-vrqlgvlU61aEO6jd1SLLEqJDZG1k+eTBozcyPmhUp2U="; 19 + }; 20 + }; 21 + }; 22 + extraDescription = '' 23 + A JSON Patch is a sequence of editing and checking operations to perform against another JSON document. 24 + It is specified in IETF RFC 6902: https://datatracker.ietf.org/doc/html/rfc6902/ 25 + 26 + The schema is maintained by the community at https://www.schemastore.org, which is a collection of JSON Schemas for various purposes. 27 + ''; 28 + meta = { 29 + maintainers = with lib.maintainers; [ roberth ]; 30 + license = lib.licenses.asl20; 31 + changelog = "https://github.com/schemastore/schemastore/commits/master/src/schemas/json/json-patch.json"; 32 + }; 33 + }
+39
pkgs/data/json-schema/catalogs/json-schema.nix
··· 1 + { 2 + fetchurl, 3 + lib, 4 + newCatalog, 5 + }: 6 + 7 + newCatalog { 8 + name = "json-schema"; 9 + displayName = "JSON Schema Metaschemas"; 10 + groups = { 11 + "JSON Schema" = { 12 + "http://json-schema.org/draft-04/schema#" = fetchurl { 13 + name = "json-schema-draft-04"; 14 + url = "https://json-schema.org/draft-04/schema"; 15 + hash = "sha256-4UidC0dV8CeTMCWR0/y48Htok6gqlPJIlfjk7fEbguI="; 16 + }; 17 + "http://json-schema.org/draft-06/schema#" = fetchurl { 18 + name = "json-schema-draft-06"; 19 + url = "https://json-schema.org/draft-06/schema"; 20 + hash = "sha256-AGTogLohS/8c7lEeZ4++SMmCbdNZ6R4kI/w23mey6+E="; 21 + }; 22 + "http://json-schema.org/draft-07/schema#" = fetchurl { 23 + name = "json-schema-draft-07"; 24 + url = "https://json-schema.org/draft-07/schema"; 25 + hash = "sha256-aS4dFl5Hr8tfEbLOHGOWNf+oNANdbstrzzCHSB2uhAQ="; 26 + }; 27 + # Unclear how newer metaschemas should be handled, so leaving them out for now. 28 + # https://github.com/roberth/json-schema-catalog-rs/issues/8 29 + }; 30 + }; 31 + meta = { 32 + maintainers = with lib.maintainers; [ roberth ]; 33 + # https://github.com/json-schema-org/json-schema-spec/blob/main/LICENSE 34 + license = [ 35 + lib.licenses.bsd3 36 + lib.licenses.afl3 37 + ]; 38 + }; 39 + }
+28
pkgs/data/json-schema/default.nix
··· 1 + { 2 + lib, 3 + newScope, 4 + json-schema-catalog-rs, 5 + jsonschema-cli, 6 + }: 7 + let 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 + ); 24 + in 25 + { 26 + # Exported to `pkgs` 27 + inherit jsonSchemaCatalogs; 28 + }
+120
pkgs/data/json-schema/lib.nix
··· 1 + { 2 + lib, 3 + json-schema-catalog-rs, 4 + runCommand, 5 + jq, 6 + }: 7 + let 8 + 9 + /** 10 + A somewhat opinionated method for constructing a JSON Schema Catalog from files in a Nix store. 11 + 12 + The input is a slightly simpler format: 13 + 14 + ```nix 15 + { 16 + name = "my-catalog"; # derivation name, default displayName 17 + displayName = "My Catalog"; # optional 18 + groups = { 19 + "Group One" = { 20 + "https://example.com/schemas/one-v1.json" = pkgs.fetchurl { ... }; 21 + "https://example.com/schemas/one-v2.json" = pkgs.fetchurl { ... }; 22 + "https://example.com/schemas/one-common.json" = pkgs.fetchurl { ... }; 23 + }; 24 + "Group Two" = { 25 + "https://example.com/schemas/two-v1.json" = ./two-v1.json; # Files can be local 26 + }; 27 + }; 28 + } 29 + ``` 30 + */ 31 + newCatalog = 32 + { 33 + name, 34 + displayName ? name, 35 + groups, 36 + version ? null, 37 + extraDescription ? null, 38 + meta ? { }, 39 + }: 40 + let 41 + # lazyDerivation tidies up the package attributes 42 + package = lib.lazyDerivation { 43 + derivation = drv; 44 + passthru = { 45 + name = "catalog-${name}"; 46 + internals = drv; 47 + } 48 + // lib.optionalAttrs (version != null) { 49 + inherit version; 50 + }; 51 + meta = { 52 + description = "JSON Schema Catalog for ${displayName}"; 53 + longDescription = 54 + let 55 + licenses = lib.toList meta.license; 56 + show = license: license.fullName or license; 57 + theLicensesApply = 58 + if lib.length licenses == 1 then 59 + "The package license, ${show (lib.head licenses)}, applies" 60 + else 61 + "The package licenses, ${lib.concatMapStringsSep " / " show licenses}, apply"; 62 + in 63 + '' 64 + A JSON Schema Catalog is a mapping from URIs to JSON Schema documents. 65 + It enables offline use, e.g. in build processes, and therefore it improves performance, robustness and safety. 66 + ${lib.optionalString (extraDescription != null) "\n${extraDescription}\n"} 67 + ${theLicensesApply} to the schemas in this catalog. The catalog file itself is licensed under the terms of the Nix expression that governs it, e.g. MIT in the case of Nixpkgs. 68 + ''; 69 + } 70 + // meta; 71 + }; 72 + 73 + drvArgs = { 74 + pname = name; 75 + catalogJson = builtins.toJSON { 76 + name = displayName; 77 + groups = lib.mapAttrsToList (name: group: { 78 + inherit name; 79 + # TODO dedup the longest common prefix by putting it in baseLocation 80 + baseLocation = "/"; 81 + schemas = lib.mapAttrsToList (id: location: { 82 + inherit id; 83 + inherit location; 84 + }) group; 85 + }) groups; 86 + }; 87 + passAsFile = [ "catalogJson" ]; 88 + passthru = { 89 + inherit groups; 90 + }; 91 + nativeBuildInputs = [ 92 + jq 93 + json-schema-catalog-rs 94 + ]; 95 + } 96 + // lib.optionalAttrs (version != null) { 97 + inherit version; 98 + }; 99 + 100 + drv = runCommand "${package.name}${lib.optionalString (version != null) "-${version}"}" drvArgs '' 101 + out_dir="$out/share/json-schema-catalogs" 102 + out_file="$out_dir/$name.json" 103 + 104 + mkdir -p "$out_dir" 105 + 106 + # Write the catalog JSON. `jq` formats it nicely. 107 + jq . <"$catalogJsonPath" >"$out_file" 108 + 109 + json-schema-catalog check "$out_file" 110 + ''; 111 + in 112 + package; 113 + in 114 + { 115 + lib = 116 + # Exported as part of `pkgs.jsonSchemaCatalogs` 117 + { 118 + inherit newCatalog; 119 + }; 120 + }
+69
pkgs/data/json-schema/tests.nix
··· 1 + { 2 + json-schema, 3 + lib, 4 + json-schema-catalog-rs, 5 + runCommand, 6 + }: 7 + 8 + lib.recurseIntoAttrs { 9 + test-with-json-schema-catalog-rs = 10 + runCommand "json-schema-catalogs-integration-test" 11 + { 12 + nativeBuildInputs = [ 13 + json-schema 14 + json-schema-catalog-rs 15 + ]; 16 + } 17 + '' 18 + cat >example.json <<"EOF" 19 + { 20 + "$id": "https://example.com/schemas/integration-test.json", 21 + "$schema": "http://json-schema.org/draft-07/schema#", 22 + "title": "Integration Test", 23 + "type": "object", 24 + "oneOf": [ 25 + { 26 + "$ref": "http://json-schema.org/draft-07/schema#" 27 + }, 28 + { 29 + "$ref": "http://json-schema.org/draft-07/schema#/definitions/yolo" 30 + }, 31 + { 32 + "$ref": "./foo.json#/definitions/bar" 33 + } 34 + ] 35 + } 36 + EOF 37 + cat >example.json.expected <<"EOF" 38 + { 39 + "$id": "https://example.com/schemas/integration-test.json", 40 + "$schema": "http://json-schema.org/draft-07/schema#", 41 + "oneOf": [ 42 + { 43 + "$ref": "file://${ 44 + json-schema.internals.groups."JSON Schema"."http://json-schema.org/draft-07/schema#" 45 + }#" 46 + }, 47 + { 48 + "$ref": "file://${ 49 + json-schema.internals.groups."JSON Schema"."http://json-schema.org/draft-07/schema#" 50 + }#/definitions/yolo" 51 + }, 52 + { 53 + "$ref": "./foo.json#/definitions/bar" 54 + } 55 + ], 56 + "title": "Integration Test", 57 + "type": "object" 58 + } 59 + EOF 60 + ( set -x; 61 + ! grep '##' example.json.expected 62 + ) 63 + 64 + json-schema-catalog replace --verbose example.json > example.json.out 65 + 66 + diff -U3 --color=always example.json.expected example.json.out 67 + touch $out 68 + ''; 69 + }
+7
pkgs/top-level/all-packages.nix
··· 11474 11474 11475 11475 iosevka-comfy = recurseIntoAttrs (callPackages ../data/fonts/iosevka/comfy.nix { }); 11476 11476 11477 + /** 11478 + A JSON Schema Catalog is a mapping from URIs to JSON Schema documents. 11479 + 11480 + It enables offline use, e.g. in build processes, and it improves performance, robustness and safety. 11481 + */ 11482 + inherit (callPackage ../data/json-schema/default.nix { }) jsonSchemaCatalogs; 11483 + 11477 11484 kde-rounded-corners = 11478 11485 kdePackages.callPackage ../data/themes/kwin-decorations/kde-rounded-corners 11479 11486 { };