gunk-dev/the-valley

attest.nix

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