gunk-dev/the-valley

identity.nix

sourcedfa994caaeb3main's published tip history
2.0 KiB
1# The identity registry compiler, driven end to end. What it renders is
2# checkable against something already written down: the known-signers file
3# the instance maintains by hand today is exactly what the registry must
4# compile to, so the golden case is a byte-for-byte comparison against the
5# artifact this compiler exists to replace. The grants it compiles are then
6# read by the pre-receive hook a host renders: request, and restack, whose
7# holder adds a version to another principal's ready change and writes its
8# restack report. The registry is read past a replacement ref planted to
9# forge it.
10#
11# The schema's own rejections live with the other schemas, in schema.nix.
12{
13 pkgs,
14 packages,
15 hosts,
16 ...
17}:
18{
19 # The compiler's Go tests, run in the package's checkPhase: the key
20 # hash pinned against the reference vector attest is held to, expiry,
21 # and the renders it must refuse.
22 identity-unit = packages.identity-unwrapped;
23
24 identity-e2e = pkgs.runCommand "valley-identity-e2e" {
25 nativeBuildInputs = [
26 pkgs.git
27 pkgs.openssh
28 packages.identity
29 # attest, so the compiled verifier line is checked against the
30 # implementation that reads it and not only against a fixed vector.
31 packages.attest
32 ];
33 registry = ../../examples/identity/registry;
34 compiled = ../../examples/identity/compiled;
35 expired = ../../examples/identity/expired;
36 # The fail-safe case. Any invalid registry would do; this one fails on a
37 # property of the floor rather than on a typo, so the check also
38 # observes that a floor violation is what stops a compilation.
39 invalid = ../../examples/identity/rejected/external-governs-registry.cue;
40 # A host compiling the registry, whose rendered pre-receive hook reads
41 # the compiled grants. The check follows the hook out of its init
42 # script, so what it drives is what such a host would run.
43 identityInitScript = hosts.identityHost.config.systemd.services.valley-init.script;
44 passAsFile = [ "identityInitScript" ];
45 } (builtins.readFile ./identity-e2e.sh);
46}