gunk-dev/the-valley

schema.nix

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