gunk-dev/the-valley

schema.nix

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