gunk-dev/the-valley

schema.nix

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