gunk-dev/the-valley

schema.nix

source5bff6e106014main's published tip history
2.4 KiB
1# The schemas against the examples they must accept and the ones they must
2# reject. CUE closedness is easy to regress silently — embedding a
3# definition instead of referencing it opens the schema — so every rejection
4# is a checked-in example, and the ones whose field carries the weight are
5# held to naming it.
6{ pkgs, ... }:
7{
8 # A host declaration: the pilot's own, the compatibility case, the
9 # protection block the installer renders a hook from, and the nine
10 # declarations the schema must refuse. The event payloads live here too —
11 # the publisher hook's vocabulary is a schema like any other.
12 cue-vet = pkgs.runCommand "valley-cue-vet" {
13 nativeBuildInputs = [ pkgs.cue ];
14 schema = ../../schema/valley.cue;
15 example = ../../examples/host.cue;
16 hosts = ../../examples/hosts;
17 eventSchema = ../../schema/events.cue;
18 events = ../../examples/events;
19 rejectedCases = ./cue-vet-rejected.txt;
20 } (builtins.readFile ./cue-vet.sh);
21
22 # The attestation statement schema (dcr-0de694f). A statement the
23 # helper composes must vet, and the schema must reject what it
24 # claims to reject. Two rejections carry the decision's whole
25 # weight and are pinned by name in the script: a subject with no
26 # content-addressed digest has no identity at all, and a
27 # predicate that crosses the pure/effectful line would let a
28 # notarization pass itself off as re-derivable.
29 attest-schema = pkgs.runCommand "valley-attest-schema" {
30 nativeBuildInputs = [ pkgs.cue ];
31 schema = ../../schema/attestation.cue;
32 statements = ../../examples/attestations;
33 } (builtins.readFile ./attest-schema.sh);
34
35 # The identity registry schema (dcr-b87f6e8). The worked registry vets,
36 # and the ten registries the schema must refuse are refused. Four of those
37 # are the substrate's floor over every instance registry — mandatory
38 # expiry where a raw key is held, an external principal carrying one, no
39 # external principal governing the registry, a genesis entry that governs
40 # it — and a floor that stopped being enforced would be silent, so each is
41 # held to naming its field.
42 identity-schema = pkgs.runCommand "valley-identity-schema" {
43 nativeBuildInputs = [ pkgs.cue ];
44 schema = ../../schema/identity.cue;
45 registry = ../../examples/identity/registry;
46 rejected = ../../examples/identity/rejected;
47 rejectedCases = ./identity-rejected.txt;
48 } (builtins.readFile ./identity-schema.sh);
49}