gunk-dev/the-valley

schema.nix

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