gunk-dev/the-valley

schema.nix

sourcedc7708a21f33main's published tip history
2.6 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 twelve
10 # declarations the schema must refuse. The event payloads live here too —
11 # the publisher hook's vocabulary is a schema like any other — and so
12 # does the worked verification policy under examples/policy/.
13 cue-vet = pkgs.runCommand "valley-cue-vet" {
14 nativeBuildInputs = [ pkgs.cue ];
15 schema = ../../schema/valley.cue;
16 example = ../../examples/host.cue;
17 hosts = ../../examples/hosts;
18 eventSchema = ../../schema/events.cue;
19 events = ../../examples/events;
20 rejectedCases = ./cue-vet-rejected.txt;
21 verificationSchema = ../../schema/verification.cue;
22 policies = ../../examples/policy;
23 } (builtins.readFile ./cue-vet.sh);
24
25 # The attestation statement schema (dcr-0de694f). A statement the
26 # helper composes must vet, and the schema must reject what it
27 # claims to reject. Two rejections carry the decision's whole
28 # weight and are pinned by name in the script: a subject with no
29 # content-addressed digest has no identity at all, and a
30 # predicate that crosses the pure/effectful line would let a
31 # notarization pass itself off as re-derivable.
32 attest-schema = pkgs.runCommand "valley-attest-schema" {
33 nativeBuildInputs = [ pkgs.cue ];
34 schema = ../../schema/attestation.cue;
35 statements = ../../examples/attestations;
36 } (builtins.readFile ./attest-schema.sh);
37
38 # The identity registry schema (dcr-b87f6e8). The worked registry vets,
39 # and the ten registries the schema must refuse are refused. Four of those
40 # are the substrate's floor over every instance registry — mandatory
41 # expiry where a raw key is held, an external principal carrying one, no
42 # external principal governing the registry, a genesis entry that governs
43 # it — and a floor that stopped being enforced would be silent, so each is
44 # held to naming its field.
45 identity-schema = pkgs.runCommand "valley-identity-schema" {
46 nativeBuildInputs = [ pkgs.cue ];
47 schema = ../../schema/identity.cue;
48 registry = ../../examples/identity/registry;
49 rejected = ../../examples/identity/rejected;
50 rejectedCases = ./identity-rejected.txt;
51 } (builtins.readFile ./identity-schema.sh);
52}