gunk-dev/the-valley

attest.nix

source68428773b826main's published tip history
2.1 KiB
1# The attestation helper: its unit tests, the written form as a fixed
2# contract, and the helper driven end to end over scratch repositories.
3{
4 pkgs,
5 packages,
6 nixStandIns,
7 ...
8}:
9{
10 # The helper's Go tests, run in the package's checkPhase against real
11 # git and ssh-keygen: the written form, the note's key hash and
12 # signatures, and the tree digest and input manifest. The unwrapped
13 # package, because its checkPhase is where the tests run.
14 attest-unit = packages.attest-unwrapped;
15
16 # The written form and the note envelope, held to fixed vectors.
17 # These bytes are an interop contract rather than an
18 # implementation detail: a regenerated or independently written
19 # attest must produce them identically or every signature already
20 # made stops verifying. So the vectors are checked-in files with a
21 # README saying they are the contract (attest/conformance/), and
22 # this check is what holds a second implementation to them.
23 attest-conformance = pkgs.runCommand "valley-attest-conformance" {
24 nativeBuildInputs = [
25 pkgs.cue
26 packages.attest
27 ];
28 vectorDir = ../../attest/conformance;
29 schema = ../../schema/attestation.cue;
30 } (builtins.readFile ./attest-conformance.sh);
31
32 # The helper itself, driven end to end over scratch repositories
33 # and a throwaway key: what it publishes, what it refuses to
34 # publish, and what a verifier makes of both.
35 #
36 # A real nix cannot run inside a nix build — there is no daemon in
37 # the sandbox — so the nix runner is driven through integrator-e2e's
38 # stand-in for nix: the shared evaluation, a build per check, mixed
39 # outcomes, an output two checks share, and what a run with a failed
40 # check refuses to publish. What a pure statement looks like is
41 # pinned by attest-schema and by the unit tests over the digest
42 # scheme, and the runner against a real nix by attest's Go tests
43 # outside the sandbox.
44 attest-e2e = pkgs.runCommand "valley-attest-e2e" {
45 nativeBuildInputs = [
46 pkgs.git
47 pkgs.openssh
48 packages.attest
49 ];
50 nixStandIn = nixStandIns;
51 } (builtins.readFile ./attest-e2e.sh);
52}