| 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, and the registry is read past |
| 7 | # a replacement ref planted to forge it. |
| 8 | # |
| 9 | # The schema's own rejections live with the other schemas, in schema.nix. |
| 10 | { |
| 11 | pkgs, |
| 12 | packages, |
| 13 | hosts, |
| 14 | ... |
| 15 | }: |
| 16 | { |
| 17 | identity-e2e = pkgs.runCommand "valley-identity-e2e" { |
| 18 | nativeBuildInputs = [ |
| 19 | pkgs.git |
| 20 | pkgs.openssh |
| 21 | packages.identity |
| 22 | # attest, so the compiled verifier line is checked against the |
| 23 | # implementation that reads it and not only against a fixed vector. |
| 24 | packages.attest |
| 25 | ]; |
| 26 | registry = ../../examples/identity/registry; |
| 27 | compiled = ../../examples/identity/compiled; |
| 28 | expired = ../../examples/identity/expired; |
| 29 | # The fail-safe case. Any invalid registry would do; this one fails on a |
| 30 | # property of the floor rather than on a typo, so the check also |
| 31 | # observes that a floor violation is what stops a compilation. |
| 32 | invalid = ../../examples/identity/rejected/external-governs-registry.cue; |
| 33 | # A host compiling the registry, whose rendered pre-receive hook reads |
| 34 | # the compiled grants. The check follows the hook out of its init |
| 35 | # script, so what it drives is what such a host would run. |
| 36 | identityInitScript = hosts.identityHost.config.systemd.services.valley-init.script; |
| 37 | passAsFile = [ "identityInitScript" ]; |
| 38 | } (builtins.readFile ./identity-e2e.sh); |
| 39 | } |