gunk-dev/the-valley

packages.nix

sourcecfedff357a41main's published tip history
47.7 KiB
1# Everything this flake builds: the valley command, the
2# formatter, the attestation helper, the integrator, the identity
3# compiler, the pre-receive hook's policy, the security-key signature
4# verifier. The flake wires these into packages, apps, and the checks that
5# drive them; nothing here knows about any of those outputs.
6{
7 pkgs,
8 lib,
9 # The commit the flake is built from: its full SHA, the SHA with -dirty
10 # after it for a tree with uncommitted changes, or null when nix knows no
11 # commit. Only the installed CLI's version stamp reads it.
12 rev ? null,
13}:
14rec {
15 # The CLI's version, which `valley --version` prints and self-update
16 # reads to tell which commit is installed (selfupdate/): cliVersion and
17 # the short commit, as 0.1.0-97db597. A dirty tree's has -dirty after
18 # it, and with no commit known it ends in -unknown, so neither names a
19 # commit.
20 cliVersion = "0.1.0";
21 version =
22 if rev == null then
23 "${cliVersion}-unknown"
24 else if lib.hasSuffix "-dirty" rev then
25 "${cliVersion}-${builtins.substring 0 7 rev}-dirty"
26 else
27 "${cliVersion}-${builtins.substring 0 7 rev}";
28
29 # What no Go build or test here reads: prose and .gitignore files. A Go
30 # package's source leaves them out, so editing a module's README rebuilds
31 # nothing.
32 unread = lib.fileset.fileFilter (f: f.hasExt "md" || f.name == ".gitignore") ../.;
33
34 # The parts of the approval module (approval/) that only the approval
35 # package builds and tests: its command, the PIV signer's C source and
36 # the fixtures. A module that imports the approval library leaves them
37 # out of its source.
38 approvalExtras = [
39 ../approval/cmd
40 ../approval/piv
41 ../approval/testdata
42 ];
43
44 # Every Go test file in the tree. No package's build reads one.
45 goTests = lib.fileset.fileFilter (f: lib.hasSuffix "_test.go" f.name) ../.;
46
47 # The programs a person or an agent runs on their own machine, by package
48 # name, each with the Go build its package is made from. flake.nix offers
49 # these packages, and the formatter, on aarch64-darwin as well as on
50 # x86_64-linux, and valley-darwin-build (nix/checks/darwin.nix) compiles
51 # each build for Darwin. The programs only a valley host or its web edge
52 # runs, such as the integrator, the push hook, the check worker and the
53 # web server, are offered on Linux alone.
54 clientPrograms = {
55 inherit
56 klaus
57 approval
58 sigverify
59 ;
60 valley = valley-unwrapped;
61 attest = attest-unwrapped;
62 identity = identity-unwrapped;
63 };
64
65 # A Darwin build takes no cgo, the way valley-darwin-build compiles it, so
66 # that check compiles what a Mac runs. Elsewhere this is empty, and
67 # buildGoModule's default stands.
68 noCgoOnDarwin = lib.optionalAttrs pkgs.stdenv.hostPlatform.isDarwin { CGO_ENABLED = 0; };
69
70 # A Go module of this repository, built as a package that runs no tests,
71 # with its unit tests beside it as the package's unit attribute.
72 #
73 # The package's source is what its build reads: the module's directory
74 # (dir) and the modules of this repository it uses (modules), which its
75 # go.mod replaces with their local directories, each in its place in the
76 # tree. Nothing shared this way is fetched. The source holds no test file
77 # and none of the files only the tests read (tests.reads), and the
78 # package's checkPhase is off. So an edit to a test, or to a file only the
79 # tests read, changes neither the package nor any check built on it.
80 #
81 # unit is the same build over the same source with the module's own tests
82 # and tests.reads added, and with its checkPhase on. The checkPhase runs
83 # go test, with the rest of tests: the tools the tests need, and what runs
84 # before and after them, such as go vet. Each module's unit is its unit
85 # check (nix/checks/), so its tests run in that check and in no package
86 # build.
87 #
88 # A file the tests read is in unit's source though it is prose, so a test
89 # may read the repository's documents.
90 #
91 # excluded names files of dir that neither the build nor the tests read:
92 # files only a flake check reads, or the part of a shared module that
93 # another package builds and tests.
94 goModule =
95 {
96 dir,
97 modules ? [ ],
98 excluded ? [ ],
99 tests ? { },
100 ...
101 }@args:
102 let
103 testReads = tests.reads or [ ];
104 source =
105 fileset:
106 lib.fileset.toSource {
107 root = ../.;
108 inherit fileset;
109 };
110 build = lib.fileset.difference (lib.fileset.unions ([ dir ] ++ modules)) (
111 lib.fileset.unions ([ unread goTests ] ++ excluded ++ testReads)
112 );
113 withTests = lib.fileset.union (lib.fileset.difference (lib.fileset.unions [
114 build
115 (lib.fileset.intersection goTests dir)
116 ]) (lib.fileset.unions ([ unread ] ++ excluded))) (lib.fileset.unions testReads);
117 in
118 pkgs.buildGoModule (
119 finalAttrs:
120 removeAttrs args [
121 "dir"
122 "modules"
123 "excluded"
124 "tests"
125 ]
126 // {
127 version = "0";
128 src = source build;
129 modRoot = lib.path.removePrefix ../. dir;
130 env = (args.env or { }) // noCgoOnDarwin;
131 # Standard library only, so no module is fetched.
132 vendorHash = null;
133 doCheck = false;
134 passthru.unit = finalAttrs.finalPackage.overrideAttrs (
135 prev:
136 removeAttrs tests [ "reads" ]
137 // {
138 pname = "${prev.pname}-unit";
139 src = source withTests;
140 doCheck = true;
141 }
142 );
143 }
144 );
145
146 # vendorHash = null builds in vendor mode, which has no reading of a local
147 # replace. The replaced module is a directory beside the program and
148 # nothing is fetched either way, so these builds read go.mod as written.
149 readsGoMod = ''
150 export GOFLAGS="''${GOFLAGS//-mod=vendor/-mod=mod}"
151 '';
152
153 # Markdown prose is filled paragraphs hard-wrapped at 100 columns
154 # (ida-1ec03b1). One flag string backs both the formatter app and the
155 # prose-format check, so the two cannot drift. Embedded-language
156 # formatting is off so fenced code blocks pass through byte-for-byte.
157 proseFmtArgs = "--prose-wrap always --print-width 100 --embedded-language-formatting off";
158
159 # The valley command (status/), the raw Go binary with nothing wrapped:
160 # the verbs that read a change's state from origin and write its record,
161 # review and approve, the plan graph's verbs, the bus's, checks and
162 # self-update. status reads one change's request and outcome record from
163 # origin, and prints them as sentences or as the valley-status/v1 JSON
164 # object front ends read. ready, unready and withdraw write a change's
165 # record, with the one reading of a record the push hook shares
166 # (../change). rebase rebases a change's whole stack and adds each
167 # change's rebased head to its record, through the rebase engine
168 # (../rebase), which also reads how far each version has landed for the
169 # listings. knot reads and writes the plan graph, with the one reading of
170 # a graph the push hook shares (../knot), and plan shows that graph as a
171 # view. review reads a version's file delta and its approved version's
172 # with the one reading of valley-delta-v1 (../delta). self-update
173 # installs the tip of a branch of the-valley into the user's nix profile
174 # (../selfupdate). checks prints which checks a change requires, as the
175 # deriver (../derive) derives them from the policy the composed-policy
176 # reader (../composed) reads. approve and review sign an approval, when
177 # an approval key is selected, in the approval format (../approval). On
178 # Linux a YubiKey's PIV slot signs through the PIV signer, fixed at build
179 # time as the approval command's is. The signer is Linux C, so elsewhere
180 # the binary carries none, and selecting a PIV slot is refused; a
181 # software key signs everywhere. Go, standard library only. It runs
182 # whatever git, cue, less, attest and nats are on PATH, so checks that
183 # put a failing stand-in for one ahead of it run this binary rather than
184 # a wrapper. Its unit tests hold its shell quoting to bash, so they need
185 # bash, lay pending out over real repositories, so they need git, and
186 # derive a change's checks under the verification schema, so they need
187 # cue and the schema. The plan's golden files (status/testdata/plan/) are
188 # valley-plan's, and no Go test reads them.
189 valley-unwrapped = goModule {
190 pname = "valley-unwrapped";
191 dir = ../status;
192 modules = [
193 ../approval
194 ../change
195 ../composed
196 ../delta
197 ../derive
198 ../knot
199 ../note
200 ../rebase
201 ../selfupdate
202 ../telemetry
203 ];
204 excluded = [ ../status/testdata/plan ] ++ approvalExtras;
205 preBuild = readsGoMod;
206 ldflags = lib.optionals pkgs.stdenv.hostPlatform.isLinux [
207 "-X main.pivSigner=${lib.getExe piv-signer}"
208 ];
209 tests = {
210 reads = [ ../schema/verification.cue ];
211 nativeCheckInputs = [
212 pkgs.bash
213 pkgs.git
214 pkgs.cue
215 ];
216 # A test that cannot find a tool it needs fails rather than skipping.
217 preCheck = ''
218 export VALLEY_TEST_TOOLS=required
219 '';
220 };
221 meta.mainProgram = "valley";
222 };
223
224 # The valley command with the tools it runs: git, natscli (tail and
225 # replay), cue (checks and approving, which compose the policy layers),
226 # less (review's notes) and attest (approving, which runs the checks and
227 # signs them). The verification schema travels with it, as it does with
228 # the integrator: only the-valley's own tree carries schema/, so a
229 # project's checkout has none to read. --set-default leaves an explicit
230 # VALLEY_VERIFICATION_SCHEMA in charge. It carries no stamp, so the
231 # packages the checks and the integrator use do not change with every
232 # commit.
233 valley-unstamped =
234 pkgs.runCommand "valley"
235 {
236 nativeBuildInputs = [ pkgs.makeWrapper ];
237 meta.mainProgram = "valley";
238 }
239 ''
240 mkdir -p $out/bin
241 makeWrapper ${lib.getExe valley-unwrapped} $out/bin/valley \
242 --prefix PATH : ${
243 lib.makeBinPath [
244 pkgs.git
245 pkgs.natscli
246 pkgs.cue
247 pkgs.less
248 attest
249 ]
250 } \
251 --set-default VALLEY_VERIFICATION_SCHEMA ${../schema/verification.cue}
252 '';
253
254 # The installed package: the valley command stamped with its version, the
255 # shell completions at the standard paths home-manager/NixOS auto-link,
256 # and the tiny policy self-update's smoke test derives checks from
257 # (examples/policy/smoke/). The stamp is set on this outer wrapper alone,
258 # so the packages the checks and the integrator use do not change with
259 # every commit. The name carries the version as well: nix profile names
260 # the element valley from it, and self-update reads a hand-installed
261 # valley's commit from it.
262 valley =
263 pkgs.runCommand "valley-${version}"
264 {
265 inherit version;
266 nativeBuildInputs = [
267 pkgs.makeWrapper
268 pkgs.installShellFiles
269 ];
270 meta.mainProgram = "valley";
271 }
272 ''
273 mkdir -p $out/bin $out/share/valley
274 makeWrapper ${lib.getExe valley-unstamped} $out/bin/valley \
275 --set VALLEY_VERSION ${version}
276 installShellCompletion --bash --name valley ${../completions/valley.bash}
277 installShellCompletion --zsh --name _valley ${../completions/_valley}
278 cp -r --no-preserve=mode ${../examples/policy/smoke} $out/share/valley/smoke-policy
279 '';
280
281 # The check worker: one pass of `valley work` (status/worker.go), which
282 # builds the nix checks ready changes require and publishes the evidence
283 # before anyone approves them. It runs this flake's git, cue and attest,
284 # and the verification schema travels with it, as it does with the CLI.
285 # nix is the machine's own, for the reason attest gives.
286 valley-worker =
287 pkgs.runCommand "valley-worker"
288 {
289 nativeBuildInputs = [ pkgs.makeWrapper ];
290 meta.mainProgram = "valley-worker";
291 }
292 ''
293 mkdir -p $out/bin
294 makeWrapper ${lib.getExe valley-unwrapped} $out/bin/valley-worker \
295 --add-flags work \
296 --prefix PATH : ${
297 lib.makeBinPath [
298 pkgs.git
299 pkgs.cue
300 attest
301 ]
302 } \
303 --set-default VALLEY_VERIFICATION_SCHEMA ${../schema/verification.cue}
304 '';
305
306 # `nix run .#fmt` — rewrap every tracked *.md in the repo to 100 columns.
307 # GNU xargs is pinned with git and prettier: a Mac's own takes no
308 # --no-run-if-empty.
309 prose-fmt = pkgs.writeShellApplication {
310 name = "valley-fmt";
311 runtimeInputs = [
312 pkgs.git
313 pkgs.prettier
314 pkgs.findutils
315 ];
316 text = ''
317 cd "$(git rev-parse --show-toplevel)"
318 git ls-files -z -- '*.md' | xargs -0 --no-run-if-empty \
319 prettier ${proseFmtArgs} --write
320 '';
321 };
322
323 # The Phase 2 attestation helper (dcr-0de694f). Go, standard library
324 # only, note format included, and hence no module fetch at build time.
325 # Its unit tests need git and ssh-keygen, and cue, which one test runs
326 # to show that a batch's statements are vetted each on its own. It reads
327 # signed notes, and writes and reads the statements in them and the
328 # valley-tree-v1 digests they name, with the note module (../note), the
329 # one reading of the envelope and its statement shared by the programs
330 # that write, verify and admit attestations. The conformance vectors
331 # (attest/conformance/) are attest-conformance's, and no Go test reads
332 # them.
333 attest-unwrapped = goModule {
334 pname = "valley-attest";
335 dir = ../attest;
336 modules = [
337 ../note
338 ../telemetry
339 ];
340 excluded = [ ../attest/conformance ];
341 preBuild = readsGoMod;
342 tests = {
343 nativeCheckInputs = [
344 pkgs.git
345 pkgs.openssh
346 pkgs.cue
347 ];
348 preCheck = ''
349 export ATTEST_CUE_TESTS=require
350 '';
351 };
352 meta.mainProgram = "attest";
353 };
354
355 # The shipping form. git and cue are pinned to this flake's nixpkgs,
356 # so every host composes and vets a statement with the same tools.
357 # Signing needs no tool at all: a note is signed on crypto/ed25519
358 # inside the binary. `nix` is deliberately NOT pinned: the check being
359 # attested to must be built by the nix the machine actually runs, and
360 # a nix carried in here would be a second one.
361 attest =
362 pkgs.runCommand "valley-attest"
363 {
364 nativeBuildInputs = [ pkgs.makeWrapper ];
365 meta.mainProgram = "attest";
366 }
367 ''
368 mkdir -p $out/bin
369 makeWrapper ${lib.getExe attest-unwrapped} $out/bin/attest \
370 --prefix PATH : ${
371 lib.makeBinPath [
372 pkgs.git
373 pkgs.cue
374 ]
375 } \
376 --set-default VALLEY_ATTEST_SCHEMA ${../schema/attestation.cue}
377 '';
378
379 # The identity registry compiler (dcr-b87f6e8). Go, standard library
380 # only, note format included, same trade as attest and the integrator, so
381 # no module is fetched. It reads the registry's export with exactjson
382 # (../exactjson), and opens each approval signers file with the
383 # approval format's authority stamp (../approval), which names refs by
384 # the change record's branch rule (../change). Its unit tests pin the
385 # note format's key hash
386 # against the reference vector attest is held to, and verify a real
387 # YubiKey attestation against the Yubico roots it carries. The test
388 # vectors (identity/testdata/) are read by the tests and by identity-e2e,
389 # never by the build. One test compiles a registry in a real repository
390 # while a push moves its ref, so the tests run git and cue and read the
391 # schema.
392 identity-unwrapped = goModule {
393 pname = "valley-identity";
394 dir = ../identity;
395 modules = [
396 ../approval
397 ../change
398 ../note
399 ../exactjson
400 ];
401 # Of the approval module, only its library is read.
402 excluded = approvalExtras;
403 preBuild = readsGoMod;
404 tests.reads = [
405 ../identity/testdata
406 ../schema/identity.cue
407 ];
408 tests.nativeCheckInputs = [
409 pkgs.git
410 pkgs.cue
411 ];
412 meta.mainProgram = "identity";
413 };
414
415 # The shipping form. git reads the registry out of the instance
416 # repository's tip and cue vets and exports it, both pinned to this
417 # flake's nixpkgs so every host compiles a registry the same way. The
418 # schema travels with the binary: a compiler judging a registry against a
419 # schema the consumer supplied would be no floor at all.
420 identity =
421 pkgs.runCommand "valley-identity"
422 {
423 nativeBuildInputs = [ pkgs.makeWrapper ];
424 meta.mainProgram = "identity";
425 }
426 ''
427 mkdir -p $out/bin
428 makeWrapper ${lib.getExe identity-unwrapped} $out/bin/identity \
429 --prefix PATH : ${
430 lib.makeBinPath [
431 pkgs.git
432 pkgs.cue
433 ]
434 } \
435 --set-default VALLEY_IDENTITY_SCHEMA ${../schema/identity.cue}
436 '';
437
438 # The security-key signature verifier (sigverify/README.md). Go,
439 # standard library only, so no module is fetched.
440 #
441 # The git its git-tag command runs is fixed at build time to this
442 # flake's git, as an absolute store path compiled into the binary. A
443 # wrapper that puts git on PATH would leave the binary inside it looking
444 # git up on PATH, and a caller's environment could change which git that
445 # is. Compiled in, there is no PATH lookup to change.
446 #
447 # Its tests run against real ssh-keygen and git. The security-key cases
448 # among them need OpenSSH's sk-dummy authenticator, which the
449 # sigverify-unit check supplies. Building this package runs no test, so a
450 # consumer building it never builds OpenSSH.
451 sigverify = goModule {
452 pname = "valley-sigverify";
453 dir = ../sigverify;
454 ldflags = [ "-X main.gitProgram=${lib.getExe pkgs.git}" ];
455 tests.nativeCheckInputs = [
456 pkgs.git
457 pkgs.openssh
458 ];
459 meta.mainProgram = "sigverify";
460 };
461
462 # Telemetry (../telemetry): the diagnostic records, the bounded streams
463 # that hold them and the telemetry command's grammar, which the
464 # producers, the git user's shell and the collector share, and the
465 # collector itself, valley-telemetry serve, which the host runs per
466 # connection to its socket. Go, standard library only.
467 telemetry = goModule {
468 pname = "valley-telemetry";
469 dir = ../telemetry;
470 meta.mainProgram = "valley-telemetry";
471 };
472
473 # The reason a failed push is logged with (../pushreason): git's error
474 # output made one line fit for the journal and telemetry. The mirror
475 # pusher a host renders hands it what git printed. Go, standard library
476 # only.
477 pushreason = goModule {
478 pname = "valley-pushreason";
479 dir = ../pushreason;
480 meta.mainProgram = "pushreason";
481 };
482
483 # The bridge behind a host's services.valley.onMain binding (../onmain):
484 # it starts one unit when a project's main moves. Go, standard library
485 # only. The git it reads the repository with is compiled in, as
486 # sigverify's is, so no PATH changes which git that is. Its tests run
487 # against real git.
488 onmain = goModule {
489 pname = "valley-onmain";
490 dir = ../onmain;
491 ldflags = [ "-X main.gitProgram=${lib.getExe pkgs.git}" ];
492 tests.nativeCheckInputs = [ pkgs.git ];
493 meta.mainProgram = "onmain";
494 };
495
496 # The pre-receive hook's policy (valleyhook/): what a push may write to a
497 # project a valley host serves. It validates a push to the plan graph
498 # with the one reading of a graph the CLI shares (../knot), reads a
499 # pushed approval with the approval format (../approval), and reads the
500 # project's push policy with the push policy reader (../pushpolicy),
501 # which reads with exactjson (../exactjson). The same
502 # binary is the git user's login shell, which derives the pushing
503 # principal and pauses pushes until the host has converged. Go, standard
504 # library only, so no module is fetched.
505 #
506 # The git it reads the repository with is fixed at build time, the way
507 # sigverify's is: an absolute store path compiled into the binary, so no
508 # PATH a hook runs under can change which git that is.
509 valleyhook = goModule {
510 pname = "valley-valleyhook";
511 dir = ../valleyhook;
512 modules = [
513 ../approval
514 ../note
515 ../change
516 ../knot
517 ../pushpolicy
518 ../exactjson
519 ../telemetry
520 ];
521 # The approval library alone: its command, signer and fixtures are the
522 # approval package's.
523 excluded = approvalExtras;
524 preBuild = readsGoMod;
525 ldflags = [ "-X main.gitProgram=${lib.getExe pkgs.git}" ];
526 # The walk's and the change records' tests build hostile objects with
527 # real git.
528 tests.nativeCheckInputs = [ pkgs.git ];
529 meta.mainProgram = "valleyhook";
530 };
531
532 # The PIV session signer (approval/piv/): a small C program on libykpiv
533 # that holds a YubiKey exclusively for a run of approval signatures,
534 # asks for the PIN once on the terminal, and signs each statement with a
535 # touch. It is C so that the Go modules stay standard library only: the
536 # approval command runs it rather than linking a smart card library. It
537 # calls pcsc-lite, libykpiv's own transport, directly only to connect
538 # exclusively and to see a reset. libykpiv reconnects after a reset or a
539 # removal (_ykpiv_begin_transaction) in shared mode; the signer's
540 # libykpiv reconnects exclusively, so no command reaches the card over a
541 # shared connection even when the card changes between the helper's
542 # check and libykpiv's call. nixpkgs' default hardening applies.
543 piv-signer = pkgs.stdenv.mkDerivation {
544 pname = "valley-piv-signer";
545 version = "0";
546 src = ../approval/piv;
547 buildInputs = [
548 (pkgs.yubico-piv-tool.overrideAttrs (old: {
549 postPatch = (old.postPatch or "") + ''
550 substituteInPlace lib/ykpiv.c \
551 --replace-fail 'SCardReconnect(state->card, SCARD_SHARE_SHARED,' \
552 'SCardReconnect(state->card, SCARD_SHARE_EXCLUSIVE,' \
553 --replace-fail 'SCardConnect(state->context, state->reader, SCARD_SHARE_SHARED,' \
554 'SCardConnect(state->context, state->reader, SCARD_SHARE_EXCLUSIVE,'
555 '';
556 }))
557 pkgs.pcsclite
558 ];
559 buildPhase = ''
560 $CC -std=c11 -O2 -Wall -Wextra -Werror -o valley-piv-signer valley-piv-signer.c \
561 -I${lib.getDev pkgs.pcsclite}/include/PCSC -lykpiv -lpcsclite
562 '';
563 installPhase = ''
564 install -Dm755 valley-piv-signer $out/bin/valley-piv-signer
565 '';
566 meta.mainProgram = "valley-piv-signer";
567 };
568
569 # Approval statements (approval/): the-valley/approval/v1's written form,
570 # signing it with a software key or a YubiKey's PIV slot, and verifying
571 # an approval note under the approval signers files. Go, standard library
572 # only. On Linux the PIV signer it runs is fixed at build time, the way
573 # sigverify's git is: an absolute store path compiled into the binary.
574 # The signer is Linux C, so elsewhere the binary carries none, and
575 # `sign --piv` is refused; a software key signs everywhere. Its unit
576 # tests run that signer with no smart card service to reach, so no device
577 # is touched.
578 approval = goModule {
579 pname = "valley-approval";
580 dir = ../approval;
581 modules = [
582 ../note
583 ../change
584 ];
585 excluded = [ ../approval/piv ];
586 subPackages = [ "cmd/approval" ];
587 preBuild = readsGoMod;
588 ldflags = lib.optionals pkgs.stdenv.hostPlatform.isLinux [
589 "-X main.pivSigner=${lib.getExe piv-signer}"
590 ];
591 tests = {
592 reads = [ ../approval/testdata ];
593 subPackages = [
594 "."
595 "cmd/approval"
596 ];
597 VALLEY_PIV_SIGNER = lib.getExe piv-signer;
598 };
599 meta.mainProgram = "approval";
600 };
601
602 # The note envelope (note/). Its tests hold it to refusing every line a
603 # relayer could append that one of its readers would refuse.
604 note = goModule {
605 pname = "valley-note";
606 dir = ../note;
607 };
608
609 # The strict JSON reading (exactjson/) that the identity compiler, the
610 # pre-receive hook and read access read CUE's exports with: every key
611 # spelled exactly as the field it is read into, and no key twice in one
612 # object. Its tests
613 # hold it to each spelling encoding/json alone would fold into a field.
614 exactjson = goModule {
615 pname = "valley-exactjson";
616 dir = ../exactjson;
617 };
618
619 # A project's push policy (pushpolicy/), read exactly as the pre-receive
620 # hook reads it: the file the host module writes per project, held to
621 # exactjson's spelling, and the hook's pattern matching. Its tests hold
622 # it to both.
623 pushpolicy = goModule {
624 pname = "valley-pushpolicy";
625 dir = ../pushpolicy;
626 modules = [ ../exactjson ];
627 preBuild = readsGoMod;
628 };
629
630 # The web UI (web/). Package export is the contract between the
631 # publisher on a valley host and the web server it pushes to: the public
632 # export and the projection onto it, the signed manifest, the upload and
633 # the receiver's state directory. It reads names and IDs by the plan
634 # graph's rules (../knot), the manifest with the note module (../note),
635 # and who may read a project through ../readaccess, which reads with
636 # ../exactjson, as the publisher reads the host declaration and package
637 # export reads export.json. The program
638 # built from it is the publisher, cmd/valley-web-publish, which
639 # valley-web-publish below wraps. The server and its command are built by
640 # valley-web below, and the receiver by valley-web-receive. The export's
641 # tests accept bundles and build the shared fixture's repositories with
642 # real git. The publisher's tests run it against a valley built with real
643 # git and the valley command's raw binary, read each project's policy/read and the instance's identity
644 # registry with cue under schema/read.cue and schema/identity.cue, and
645 # upload to a receiver over a real store, and to the real receiver, whose
646 # state directory the real valley-web serves. One lands a change as the
647 # integrator does, with a transfer statement attest signs under a key
648 # ssh-keygen makes, which the CLI verifies with attest. Each test's host
649 # declaration is exported by cue under schema/valley.cue, as the module
650 # exports the host's. go vet runs after them. The fixture's expected
651 # export (export/exporttest/testdata/) is read by the tests alone, and so
652 # are README.md and docs/, whose links package markdown's tests resolve. Go,
653 # standard library only, so no module is fetched.
654 web = goModule {
655 pname = "valley-web-module";
656 dir = ../web;
657 modules = [
658 ../knot
659 ../note
660 ../readaccess
661 ../exactjson
662 ];
663 excluded = [
664 ../web/server
665 ../web/readerstate
666 ../web/cmd/valley-web
667 ../web/cmd/valley-web-receive
668 ];
669 preBuild = readsGoMod;
670 tests = {
671 reads = [
672 ../web/export/exporttest/testdata
673 ../README.md
674 ../docs
675 ../schema/read.cue
676 ../schema/identity.cue
677 ../schema/valley.cue
678 ];
679 nativeCheckInputs = [
680 pkgs.git
681 pkgs.bash
682 pkgs.cue
683 pkgs.openssh
684 valley-unwrapped
685 attest
686 ];
687 # A test that cannot find a tool it needs fails rather than skipping.
688 preCheck = ''
689 export VALLEY_TEST_TOOLS=required
690 export VALLEY_WEB=${lib.getExe valley-web}
691 export VALLEY_WEB_RECEIVE=${lib.getExe valley-web-receive}
692 '';
693 postCheck = ''
694 go vet ./...
695 '';
696 };
697 meta.mainProgram = "valley-web-publish";
698 };
699
700 # Read access (readaccess/): the two consents a principal needs to read a
701 # project, read out of git commits with cue under schema/read.cue and
702 # schema/identity.cue, and the evaluator that intersects them. The web
703 # publisher reads through it, and its command is the coverage report,
704 # which valley-read-coverage below wraps. It reads cue's exports with
705 # exactjson (../exactjson). Its tests read real commits with real git and
706 # the real cue under both schemas, and go vet runs after them. Go,
707 # standard library only, so no module is fetched.
708 readaccess = goModule {
709 pname = "valley-readaccess";
710 dir = ../readaccess;
711 modules = [ ../exactjson ];
712 preBuild = readsGoMod;
713 tests = {
714 reads = [
715 ../schema/read.cue
716 ../schema/identity.cue
717 ];
718 nativeCheckInputs = [
719 pkgs.git
720 pkgs.cue
721 ];
722 # A test that cannot find a tool it needs fails rather than skipping.
723 preCheck = ''
724 export VALLEY_TEST_TOOLS=required
725 '';
726 postCheck = ''
727 go vet ./...
728 '';
729 };
730 meta.mainProgram = "valley-read-coverage";
731 };
732
733 # The coverage report: which projects a principal cannot read at a
734 # destination, and which consent each lacks. It runs this flake's git and
735 # cue, and both schemas travel with it.
736 valley-read-coverage =
737 pkgs.runCommand "valley-read-coverage"
738 {
739 nativeBuildInputs = [ pkgs.makeWrapper ];
740 meta.mainProgram = "valley-read-coverage";
741 }
742 ''
743 mkdir -p $out/bin
744 makeWrapper ${lib.getExe readaccess} $out/bin/valley-read-coverage \
745 --prefix PATH : ${
746 lib.makeBinPath [
747 pkgs.git
748 pkgs.cue
749 ]
750 } \
751 --set-default VALLEY_READ_SCHEMA ${../schema/read.cue} \
752 --set-default VALLEY_IDENTITY_SCHEMA ${../schema/identity.cue}
753 '';
754
755 # The web UI's server (web/server/) and its command, valley-web
756 # (web/cmd/valley-web/), which serves the active export of a receiver's
757 # state directory to its readers, and keeps their sessions in the
758 # browser state (web/readerstate/). It reads the export and the
759 # state directory with package export, so its source is the web
760 # module, less the fixture's expected export, which only web's tests
761 # read. Package export reads export.json with ../exactjson, so its
762 # source holds that module too. Of ../readaccess, which the publisher
763 # reads through and the server does not, it reads the go.mod alone,
764 # which go reads to resolve the module. The git it reads repositories
765 # with is fixed at build time, the way valleyhook's is. Its tests run the real program over the shared
766 # fixture and real git, and the server over the real publisher's output
767 # (web-published), and go vet runs after them. The crash tests and the
768 # browser test are skipped there: web-reader-state-crash and
769 # web-reader-browser-e2e (nix/checks/) run them from the same tests.
770 # Go, standard library only, so no module is fetched.
771 valley-web = goModule {
772 pname = "valley-web";
773 dir = ../web;
774 modules = [
775 ../knot
776 ../note
777 ../readaccess/go.mod
778 ../exactjson
779 ];
780 excluded = [
781 ../web/export/exporttest/testdata
782 ../web/cmd/valley-web-publish
783 ../web/cmd/valley-web-receive
784 ];
785 subPackages = [ "cmd/valley-web" ];
786 preBuild = readsGoMod;
787 ldflags = [ "-X the-valley/web/export.GitProgram=${lib.getExe pkgs.git}" ];
788 tests = {
789 subPackages = [
790 "server"
791 "readerstate"
792 "cmd/valley-web"
793 ];
794 checkFlags = [ "-skip=^(TestCrash|TestBrowser)" ];
795 nativeCheckInputs = [ pkgs.git ];
796 # A test that cannot find the publisher's output fails rather than
797 # skipping.
798 preCheck = ''
799 export VALLEY_TEST_TOOLS=required
800 export VALLEY_WEB_PUBLISHED=${web-published}
801 '';
802 postCheck = ''
803 go vet ./server/... ./readerstate/... ./cmd/valley-web/...
804 '';
805 };
806 meta.mainProgram = "valley-web";
807 };
808
809 # The real publisher's signed output over a small valley with a public
810 # project, two private projects each one named reader may read, and a
811 # project with no effective reader, written with --out by the packaged publisher and CLI
812 # (nix/checks/web-published.sh). valley-web's tests read it, so the
813 # server is tested against what the publisher writes. It is no check of
814 # its own.
815 web-published =
816 pkgs.runCommand "valley-web-published"
817 {
818 nativeBuildInputs = [
819 pkgs.git
820 pkgs.cue
821 pkgs.jq
822 valley-unstamped
823 valley-web-publish
824 ];
825 schema = ../schema/valley.cue;
826 }
827 (builtins.readFile ./checks/web-published.sh);
828
829 # The web export receiver, valley-web-receive (web/cmd/valley-web-receive/),
830 # which takes the publisher's uploads into a state directory that
831 # valley-web serves. Its source is the web module less the publisher,
832 # the server and its command, which it does not build, and the fixture's
833 # expected export. Package export reads export.json with ../exactjson, so
834 # its source holds that module too; of ../readaccess it reads the go.mod
835 # alone, as valley-web does. The git it accepts bundles with is fixed at
836 # build time. Its tests run the real program over the shared fixture and
837 # real git, with the real valley-web serving its state directory, and go
838 # vet runs after them. Go, standard library only.
839 valley-web-receive = goModule {
840 pname = "valley-web-receive";
841 dir = ../web;
842 modules = [
843 ../knot
844 ../note
845 ../readaccess/go.mod
846 ../exactjson
847 ];
848 excluded = [
849 ../web/export/exporttest/testdata
850 ../web/cmd/valley-web-publish
851 ../web/cmd/valley-web
852 ../web/server
853 ../web/readerstate
854 ];
855 subPackages = [ "cmd/valley-web-receive" ];
856 preBuild = readsGoMod;
857 ldflags = [ "-X the-valley/web/export.GitProgram=${lib.getExe pkgs.git}" ];
858 tests = {
859 nativeCheckInputs = [ pkgs.git ];
860 # A test that cannot find valley-web fails rather than skipping.
861 preCheck = ''
862 export VALLEY_TEST_TOOLS=required
863 export VALLEY_WEB=${lib.getExe valley-web}
864 '';
865 postCheck = ''
866 go vet ./cmd/valley-web-receive/...
867 '';
868 };
869 meta.mainProgram = "valley-web-receive";
870 };
871
872 # The edge's container image, for a web server that does not run NixOS:
873 # valley-web and valley-web-receive, and the git both run, in one image.
874 # The two run as two containers of it over one state directory, as two
875 # users of one group: the receiver as valley-web-receive, which writes
876 # the directory, and valley-web as valley-web, which reads it. The image
877 # names both users in its /etc/passwd, and holds the state directory,
878 # owned by the receiver and readable by the group alone, so a volume
879 # mounted there starts with that owner and mode. In it, browser/ is
880 # valley-web's alone, mode 0700: the browser state, the one place
881 # valley-web writes. It runs as valley-web unless it is told otherwise,
882 # and starts no program of its own: each container names its command.
883 edgeUsers = {
884 receiver = {
885 name = "valley-web-receive";
886 uid = 990;
887 };
888 web = {
889 name = "valley-web";
890 uid = 991;
891 };
892 gid = 990;
893 };
894 valley-web-image = pkgs.dockerTools.buildLayeredImage {
895 name = "valley-web";
896 contents = [
897 valley-web
898 valley-web-receive
899 (pkgs.dockerTools.fakeNss.override {
900 extraPasswdLines = with edgeUsers; [
901 "${receiver.name}:x:${toString receiver.uid}:${toString gid}:valley-web-receive:/var/empty:/bin/false"
902 "${edgeUsers.web.name}:x:${toString edgeUsers.web.uid}:${toString gid}:valley-web:/var/empty:/bin/false"
903 ];
904 extraGroupLines = [ "valley-web:x:${toString edgeUsers.gid}:" ];
905 })
906 ];
907 fakeRootCommands = ''
908 mkdir -p var/lib/valley-web/browser tmp
909 chown ${toString edgeUsers.receiver.uid}:${toString edgeUsers.gid} var/lib/valley-web
910 chmod 0750 var/lib/valley-web
911 chown ${toString edgeUsers.web.uid}:${toString edgeUsers.gid} var/lib/valley-web/browser
912 chmod 0700 var/lib/valley-web/browser
913 chmod 1777 tmp
914 '';
915 config = {
916 User = edgeUsers.web.name;
917 WorkingDirectory = "/";
918 Env = [ "PATH=/bin" ];
919 Volumes."/var/lib/valley-web" = { };
920 };
921 };
922
923 # The web publisher: one pass of valley-web-publish, which reads a valley
924 # host's public projects through the CLI's JSON commands and uploads them
925 # to a web receiver. It runs this flake's git, cue and CLI, and the two
926 # schemas it reads read access under travel with it, as the verification
927 # schema does with the CLI.
928 valley-web-publish =
929 pkgs.runCommand "valley-web-publish"
930 {
931 nativeBuildInputs = [ pkgs.makeWrapper ];
932 meta.mainProgram = "valley-web-publish";
933 }
934 ''
935 mkdir -p $out/bin
936 makeWrapper ${lib.getExe web} $out/bin/valley-web-publish \
937 --prefix PATH : ${
938 lib.makeBinPath [
939 pkgs.git
940 pkgs.cue
941 valley-unstamped
942 ]
943 } \
944 --set-default VALLEY_READ_SCHEMA ${../schema/read.cue} \
945 --set-default VALLEY_IDENTITY_SCHEMA ${../schema/identity.cue}
946 '';
947
948 # The plan graph (knot/): its canonical form, its layout, cycles and
949 # transitions, held by its own tests. The package is knotcheck, which
950 # knot-agree runs to hold the Go validator to the CUE schema and the
951 # knowledge lint.
952 knot = goModule {
953 pname = "valley-knot";
954 dir = ../knot;
955 meta.mainProgram = "knotcheck";
956 };
957
958 # The rebase engine (rebase/): a family of stacked changes captured from
959 # one snapshot of origin, rebased in a throwaway worktree, and published
960 # as one atomic branch push and one record append per change. It verifies
961 # the integrator's transfer statements with the note module (../note).
962 # Its tests run against real repositories, real pushes and real git, with
963 # go vet after them. Go, standard library only, so no module is fetched.
964 rebase = goModule {
965 pname = "valley-rebase";
966 dir = ../rebase;
967 modules = [
968 ../change
969 ../note
970 ];
971 preBuild = readsGoMod;
972 tests = {
973 nativeCheckInputs = [ pkgs.git ];
974 postCheck = ''
975 go vet ./...
976 '';
977 };
978 };
979
980 # Self-update (selfupdate/): the installed CLI brought up to the tip of a
981 # branch, built with nix and installed into the user's profile. Its tests,
982 # with go vet after them, use a real bare repository for ls-remote and a
983 # stand-in for nix whose builds are small scripts, so nothing is built and
984 # no profile is touched. Go, standard library only, so no module is
985 # fetched.
986 selfupdate = goModule {
987 pname = "valley-selfupdate";
988 dir = ../selfupdate;
989 tests = {
990 nativeCheckInputs = [ pkgs.git ];
991 postCheck = ''
992 go vet ./...
993 '';
994 };
995 };
996
997 # The deriver of required checks (derive/): a change's paths read from
998 # git diff -z, globs matched byte by byte, and the required checks, pins,
999 # carry mode and unclassified paths derived from the whole composed
1000 # policy (../composed). Its tests, with go vet after them, derive over the
1001 # repository's own policy and the example policies, with changes drawn
1002 # from a fixed seed, so they read the schema and those policies, and need
1003 # git and cue. Go, standard library only, so no module is fetched.
1004 derive = goModule {
1005 pname = "valley-derive";
1006 dir = ../derive;
1007 modules = [ ../composed ];
1008 preBuild = readsGoMod;
1009 tests = {
1010 reads = [
1011 ../schema/verification.cue
1012 ../examples/policy
1013 ../policy/project
1014 ];
1015 nativeCheckInputs = [
1016 pkgs.git
1017 pkgs.cue
1018 ];
1019 # A test that cannot find a tool it needs fails rather than skipping.
1020 preCheck = ''
1021 export VALLEY_TEST_TOOLS=required
1022 '';
1023 postCheck = ''
1024 go vet ./...
1025 '';
1026 };
1027 };
1028
1029 # The composed-policy reader (composed/): each layer read out of git,
1030 # present, absent or refused. Its tests
1031 # read layers from real repositories, some with objects removed, and go
1032 # vet runs after them.
1033 composed = goModule {
1034 pname = "valley-composed";
1035 dir = ../composed;
1036 tests = {
1037 nativeCheckInputs = [ pkgs.git ];
1038 # A test that cannot find git fails rather than skipping.
1039 preCheck = ''
1040 export VALLEY_TEST_TOOLS=required
1041 '';
1042 postCheck = ''
1043 go vet ./...
1044 '';
1045 };
1046 };
1047
1048 # The change record (change/). Its tests cover its strict reading, its
1049 # fuzz target's seed corpus, and its branch-name rule, which they hold to
1050 # real git's check-ref-format.
1051 change = goModule {
1052 pname = "valley-change";
1053 dir = ../change;
1054 tests.nativeCheckInputs = [ pkgs.git ];
1055 };
1056
1057 # valley-delta-v1 (delta/): the encoding's strict reading, and the delta
1058 # read from real trees. Its unit tests run go vet, the conformance
1059 # vectors' script in its --check mode, which holds the committed expected
1060 # results to what the script computes, and go test, which builds each
1061 # vector's trees with real git and holds the Go code to those results.
1062 delta = goModule {
1063 pname = "valley-delta";
1064 dir = ../delta;
1065 tests = {
1066 reads = [ ../delta/testdata ];
1067 nativeCheckInputs = [
1068 pkgs.git
1069 pkgs.python3
1070 ];
1071 preCheck = ''
1072 go vet ./...
1073 python3 -I testdata/vectors.py --check testdata
1074 '';
1075 };
1076 };
1077
1078 # Review records (review/): the-valley/review/v1's strict reading, a
1079 # review's binding to the version it judged, recomputed from git within a
1080 # budget, and the append-only history a review is kept in, with the check
1081 # an append is held to. It reads change records with the one reading of a
1082 # record the push hook shares (../change), and the delta with
1083 # valley-delta-v1's bounded reading (../delta). Its tests build every
1084 # repository they read with real git and run its fuzz target's seed
1085 # corpus, and go vet runs after them. Go, standard library only, so no
1086 # module is fetched.
1087 review = goModule {
1088 pname = "valley-review";
1089 dir = ../review;
1090 modules = [
1091 ../change
1092 ../delta
1093 ];
1094 preBuild = readsGoMod;
1095 tests = {
1096 nativeCheckInputs = [ pkgs.git ];
1097 postCheck = ''
1098 go vet ./...
1099 '';
1100 };
1101 };
1102
1103 # The restacker (restack/): `valley-restacker run` reconciles on an
1104 # interval, and `once` is one pass. A pass reads origin through the
1105 # rebase engine (../rebase), plans which families to restack and which
1106 # to hold, keeps the writes in its journal, and pushes them;
1107 # `once --report-only` pushes none. It reads the cap on its
1108 # automatic versions through the composed-policy reader it shares with
1109 # the integrator (../composed), and a signer projects file through the
1110 # note module (../note). Its unit tests cover request association,
1111 # outcome currency, capacity and report bounds, and, against real git,
1112 # the journal of writes, recovery's decisions and publishing through the
1113 # rendered hook, its environment, its
1114 # scratch repository's identity, its state directory's lock and binding,
1115 # and the deadline on what it runs. go vet runs after them. Go, standard
1116 # library only, so no module is fetched.
1117 restack-unwrapped = goModule {
1118 pname = "valley-restacker";
1119 dir = ../restack;
1120 modules = [
1121 ../change
1122 ../composed
1123 ../note
1124 ../rebase
1125 ];
1126 # The program alone: e2e/transport is a module of restack-e2e's own,
1127 # which neither this build nor its tests read.
1128 excluded = [ ../restack/e2e ];
1129 subPackages = [ "." ];
1130 preBuild = readsGoMod;
1131 tests = {
1132 nativeCheckInputs = [ pkgs.git ];
1133 postCheck = ''
1134 go vet ./...
1135 '';
1136 };
1137 # The module is named for its directory; the program, for what it is.
1138 postInstall = ''
1139 mv $out/bin/restack $out/bin/valley-restacker
1140 '';
1141 meta.mainProgram = "valley-restacker";
1142 };
1143
1144 # The shipping form: git to read origin and cue to compose the policy,
1145 # both pinned to this flake's nixpkgs, with the packaged verification
1146 # schema as the default.
1147 valley-restacker =
1148 pkgs.runCommand "valley-restacker"
1149 {
1150 nativeBuildInputs = [ pkgs.makeWrapper ];
1151 meta.mainProgram = "valley-restacker";
1152 }
1153 ''
1154 mkdir -p $out/bin
1155 makeWrapper ${lib.getExe restack-unwrapped} $out/bin/valley-restacker \
1156 --prefix PATH : ${
1157 lib.makeBinPath [
1158 pkgs.git
1159 pkgs.cue
1160 ]
1161 } \
1162 --set-default VALLEY_VERIFICATION_SCHEMA ${../schema/verification.cue}
1163 '';
1164
1165 # The Phase 3 integrator (dcr-439b771). Go, standard library only,
1166 # same trade as attest, so no module is fetched. It reads change records
1167 # with the one reading of a record the push hook shares (../change),
1168 # verifier keys with the one reading of a key the note format defines
1169 # (../note), and derives required checks with the deriver (../derive).
1170 # The instance identity it publishes is the approval format's
1171 # (../approval).
1172 integrator-unwrapped = goModule {
1173 pname = "valley-integrator";
1174 dir = ../integrator;
1175 modules = [
1176 ../approval
1177 ../change
1178 ../composed
1179 ../derive
1180 ../note
1181 ../telemetry
1182 ];
1183 # The scenarios (integrator/e2e/) are integrator-e2e's, and no Go test
1184 # reads them. Of the approval module, only its library is read.
1185 excluded = [ ../integrator/e2e ] ++ approvalExtras;
1186 preBuild = readsGoMod;
1187 tests = {
1188 # The policy bridge's tests compose a policy under the verification
1189 # schema with real cue, and derive over diffs in real git.
1190 reads = [ ../schema/verification.cue ];
1191 nativeCheckInputs = [
1192 pkgs.git
1193 pkgs.cue
1194 ];
1195 };
1196 meta.mainProgram = "integrator";
1197 };
1198
1199 # The shipping form. The integrator drives four programs rather than
1200 # reimplementing what they do: attest judges every statement and
1201 # every note, cue composes the policy, git holds the requests and the
1202 # refs, and nats publishes its events. All four are pinned to this
1203 # flake's nixpkgs so an instance's integrators agree; `nix` is
1204 # deliberately absent for the same reason it is absent from attest —
1205 # a closure must be recomputed by the nix the machine actually runs.
1206 integrator =
1207 pkgs.runCommand "valley-integrator"
1208 {
1209 nativeBuildInputs = [ pkgs.makeWrapper ];
1210 meta.mainProgram = "integrator";
1211 }
1212 ''
1213 mkdir -p $out/bin
1214 makeWrapper ${lib.getExe integrator-unwrapped} $out/bin/integrator \
1215 --prefix PATH : ${
1216 lib.makeBinPath [
1217 pkgs.git
1218 pkgs.cue
1219 pkgs.natscli
1220 attest
1221 ]
1222 } \
1223 --set-default VALLEY_ATTEST_SCHEMA ${../schema/attestation.cue} \
1224 --set-default VALLEY_VERIFICATION_SCHEMA ${../schema/verification.cue} \
1225 --set-default VALLEY_EVENT_SCHEMA ${../schema/events.cue}
1226 '';
1227
1228 # klaus (flow/), the client that launches and follows agent runs: the one
1229 # module of this repository that imports third-party modules (AGENTS.md,
1230 # "Go dependencies"), so it is built here rather than by goModule, which
1231 # gives every package version "0" and no vendored modules. Its version is
1232 # the CLI's, stamped into the binary, and its vendored modules are one
1233 # fixed-output derivation, klaus-go-modules, resolved from the whole module
1234 # with its tests, so the checks in nix/checks/flow.nix build over the
1235 # same modules as the package. The package's source holds no test and no
1236 # prose, and it runs no tests: the checks do. It runs git, tmux, nix and
1237 # the agent CLIs it launches from the user's PATH; none of them is a
1238 # dependency of the package. bin/valley-flow is a symlink to bin/klaus:
1239 # the one binary names itself by the name it runs under, and `valley flow`
1240 # runs valley-flow from PATH. The attribute, the name and bin/klaus are
1241 # what an installed klaus's self-update builds, installs and smoke-tests
1242 # (flow/internal/selfupdate).
1243 flowComplete = lib.fileset.toSource {
1244 root = ../.;
1245 fileset = lib.fileset.difference ../flow unread;
1246 };
1247 klaus = pkgs.buildGoModule {
1248 pname = "klaus";
1249 inherit version;
1250 src = lib.fileset.toSource {
1251 root = ../.;
1252 fileset = lib.fileset.difference ../flow (
1253 lib.fileset.unions [
1254 unread
1255 goTests
1256 ../flow/e2e
1257 ]
1258 );
1259 };
1260 modRoot = "flow";
1261 subPackages = [ "cmd/klaus" ];
1262 env = noCgoOnDarwin;
1263 vendorHash = "sha256-vh51S12HVVFjHr0DSLZlvBFLWarOlFN7vxXApVb69Dk=";
1264 # Named without the version, which changes with every commit, and read
1265 # from the whole module, so test-only imports are vendored too.
1266 overrideModAttrs = _: _: {
1267 name = "klaus-go-modules";
1268 src = flowComplete;
1269 };
1270 ldflags = [ "-X the-valley/flow/internal/cmd.version=${version}" ];
1271 doCheck = false;
1272 postInstall = ''
1273 ln -s klaus $out/bin/valley-flow
1274 '';
1275 meta.mainProgram = "klaus";
1276 };
1277}