Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
348 lines (315 loc) · 18.2 KB
/
Copy pathflake.nix
File metadata and controls
348 lines (315 loc) · 18.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
{
inputs = {
# The only non-gen input, and it is here because `ci/flake.nix` follows it — this flake
# evaluates no nixpkgs itself. The seven tool inputs that used to sit beside it (nix-unit,
# import-tree, treefmt-nix, devshell, flake-root, git-hooks-nix, flake-parts) existed to feed
# `mkCi`'s `resolve` fallback through `genInputs`. `mkCi` lives in gen-harness now and that
# repository declares them itself, so here they were reachable from nothing.
nixpkgs.url = "https://channels.nixos.org/nixos-26.11/nixexprs.tar.xz";
# ── THE ROSTER — and every cross-dependency edge follows back to this list ──
# One `follows` line per sibling edge, so a gen library resolves to exactly ONE version across
# the whole graph. Without them nix must materialise a node per (input, path): 90 of 114 nodes
# in this lock were duplicates, `gen-prelude` alone reaching 44 copies, and a lock read by node
# NAME then returns a transitive copy rather than the pin the hub declares.
#
# The convergence is the point rather than a tidy-up. A member that cannot evaluate against the
# hub's rev of a sibling now reds its own check, where the divergence used to be silent and
# permanent — that failure is a regression caught, not a price paid for the dedup.
#
# The list is DERIVED: each line mirrors an edge the sibling's own flake declares. A sibling
# that grows an input needs its line here, or that one input re-forks while the rest converge.
# `flake.nix` cannot compute its `inputs`, so the list stays hand-kept and `ci/pin-coherence.nix`
# `hub-root-follows-complete` is what names a missing line, literally (den-hoag-4dfsv).
gen-prelude.url = "github:sini/gen-prelude";
gen-identity.url = "github:sini/gen-identity";
gen-algebra.url = "github:sini/gen-algebra";
gen-types.url = "github:sini/gen-types";
gen-types.inputs.gen-identity.follows = "gen-identity";
gen-types.inputs.gen-prelude.follows = "gen-prelude";
gen-types.inputs.gen-algebra.follows = "gen-algebra";
gen-merge.url = "github:sini/gen-merge";
gen-merge.inputs.gen-memo.follows = "gen-memo";
gen-merge.inputs.gen-prelude.follows = "gen-prelude";
gen-merge.inputs.gen-scope.follows = "gen-scope";
gen-merge.inputs.gen-types.follows = "gen-types";
gen-schema.url = "github:sini/gen-schema";
gen-schema.inputs.gen-algebra.follows = "gen-algebra";
gen-schema.inputs.gen-identity.follows = "gen-identity";
gen-schema.inputs.gen-merge.follows = "gen-merge";
gen-schema.inputs.gen-prelude.follows = "gen-prelude";
gen-schema.inputs.gen-graph.follows = "gen-graph";
gen-aspects.url = "github:sini/gen-aspects";
gen-aspects.inputs.gen-identity.follows = "gen-identity";
gen-aspects.inputs.gen-merge.follows = "gen-merge";
gen-aspects.inputs.gen-prelude.follows = "gen-prelude";
gen-aspects.inputs.gen-schema.follows = "gen-schema";
gen-aspects.inputs.gen-algebra.follows = "gen-algebra";
gen-scope.url = "github:sini/gen-scope";
gen-scope.inputs.gen-graph.follows = "gen-graph";
gen-scope.inputs.gen-identity.follows = "gen-identity";
gen-scope.inputs.gen-prelude.follows = "gen-prelude";
gen-scope.inputs.gen-algebra.follows = "gen-algebra";
gen-memo.url = "github:sini/gen-memo";
gen-memo.inputs.gen-graph.follows = "gen-graph";
gen-memo.inputs.gen-prelude.follows = "gen-prelude";
gen-graph.url = "github:sini/gen-graph";
gen-graph.inputs.gen-prelude.follows = "gen-prelude";
gen-select.url = "github:sini/gen-select";
gen-select.inputs.gen-algebra.follows = "gen-algebra";
gen-bind.url = "github:sini/gen-bind";
gen-bind.inputs.gen-prelude.follows = "gen-prelude";
gen-bind.inputs.gen-algebra.follows = "gen-algebra";
gen-dispatch.url = "github:sini/gen-dispatch";
gen-dispatch.inputs.gen-prelude.follows = "gen-prelude";
gen-class.url = "github:sini/gen-class";
gen-class.inputs.gen-merge.follows = "gen-merge";
gen-class.inputs.gen-prelude.follows = "gen-prelude";
gen-product.url = "github:sini/gen-product";
gen-product.inputs.gen-prelude.follows = "gen-prelude";
gen-settings.url = "github:sini/gen-settings";
gen-settings.inputs.gen-algebra.follows = "gen-algebra";
gen-settings.inputs.gen-bind.follows = "gen-bind";
gen-settings.inputs.gen-graph.follows = "gen-graph";
gen-settings.inputs.gen-identity.follows = "gen-identity";
gen-settings.inputs.gen-prelude.follows = "gen-prelude";
gen-settings.inputs.gen-schema.follows = "gen-schema";
gen-settings.inputs.gen-types.follows = "gen-types";
gen-link.url = "github:sini/gen-link";
gen-link.inputs.gen-algebra.follows = "gen-algebra";
gen-link.inputs.gen-aspects.follows = "gen-aspects";
gen-link.inputs.gen-identity.follows = "gen-identity";
gen-link.inputs.gen-prelude.follows = "gen-prelude";
gen-link.inputs.gen-schema.follows = "gen-schema";
gen-link.inputs.gen-scope.follows = "gen-scope";
gen-link.inputs.gen-view.follows = "gen-view";
gen-assemble.url = "github:sini/gen-assemble";
gen-assemble.inputs.gen-algebra.follows = "gen-algebra";
gen-assemble.inputs.gen-prelude.follows = "gen-prelude";
gen-assemble.inputs.gen-scope.follows = "gen-scope";
gen-view.url = "github:sini/gen-view";
gen-view.inputs.gen-graph.follows = "gen-graph";
gen-view.inputs.gen-prelude.follows = "gen-prelude";
gen-inspect.url = "github:sini/gen-inspect";
gen-inspect.inputs.gen-prelude.follows = "gen-prelude";
gen-inspect.inputs.gen-graph.follows = "gen-graph";
gen-inspect.inputs.gen-select.follows = "gen-select";
gen-inspect.inputs.gen-scope.follows = "gen-scope";
gen-inspect.inputs.gen-program.follows = "gen-program";
gen-program.url = "github:sini/gen-program";
gen-program.inputs.gen-prelude.follows = "gen-prelude";
gen-program.inputs.gen-scope.follows = "gen-scope";
gen-program.inputs.gen-algebra.follows = "gen-algebra";
gen-program.inputs.gen-identity.follows = "gen-identity";
gen-rules.url = "github:sini/gen-rules";
gen-rules.inputs.gen-algebra.follows = "gen-algebra";
gen-rules.inputs.gen-identity.follows = "gen-identity";
gen-rules.inputs.gen-merge.follows = "gen-merge";
gen-rules.inputs.gen-program.follows = "gen-program";
gen-rules.inputs.gen-aspects.follows = "gen-aspects";
gen-delivery.url = "github:sini/gen-delivery";
gen-delivery.inputs.gen-algebra.follows = "gen-algebra";
gen-delivery.inputs.gen-aspects.follows = "gen-aspects";
gen-delivery.inputs.gen-prelude.follows = "gen-prelude";
gen-delivery.inputs.gen-scope.follows = "gen-scope";
gen-delivery.inputs.gen-graph.follows = "gen-graph";
# The import-tree FORK (nixpkgs-lib-free; `(addPath dir).files` yields a bare path list the
# engine imports natively). It is a TOOL input, not a roster member: the tree-loading line is
# the framework surface's own wiring (`flakeModules/default.nix`), so the fork's pin lives
# here at the hub rather than inside an S2 construct. Same pin gen-flake carried.
import-tree.url = "github:denful/import-tree/a164a12202f58eb67559bd33b5592f20660d9baf";
};
outputs =
inputs:
let
# ★★★ L3 APPLIED TO THE HUB — the flake output IS the root, applied to what this flake's own
# inputs supply (owner-ruled 2026-09-14: "`mkGenLibs` stops being a fixed point and becomes a
# CONSUMER of the same pattern every member follows"). There is ONE construction of the roster
# and `./default.nix` is it; the two entry paths differ only in WHO supplies the members. Here
# the flake supplies them, so `follows` governs every one; the standalone path falls back to
# the root `flake.lock`. Before this, `./default.nix` did not exist and the hub was flake-only.
#
# ★★ THE THREE UNAPPLIED `.lib`s ARE L3's SECOND ARM ARRIVING, NOT AN EXCEPTION LIST.
# gen-program, gen-delivery and gen-assemble publish `lib = import ./.` UNAPPLIED, although
# each declares gen inputs (followed above): the substrate they need is the consumer's to
# supply, not their own flake's; the other 18 publish an applied set. What is written here is therefore the member's own L3 arm read off its published
# surface, and it is LOUD if that arm ever changes — applying an already-applied set is
# `attempt to call something which is not a function but a set`, and a member that went the
# other way arrives as a function and reds `ci/mkgenlibs-eval.nix`'s deepSeq force (den-hoag-ydm94
# R7 retired the root's own forcing output, `roster`, once that check was confirmed to force the
# same key set more deeply). The rejected
# alternative was to arity-dispatch here (`if builtins.isFunction v then v { } else v`), which
# makes the hub TOLERANT of either shape and so accepts a member that landed the wrong arm in
# silence — the failure L3 exists to make loud.
#
# AN UNAPPLIED ARM IS PRECISELY THE ONE WHOSE ARGUMENTS THE CONSUMER OWES (ADR-0008 §1).
# Until this fold, the three were applied to `{ }`, so each self-fetched its own substrate
# instance out of its own `ci/flake.lock` instead of receiving the hub's — the defect
# `./lib/hubSubstrate.nix` closes. That file is a pure function of `members` below (never of
# `inputs`), naming exactly the substrate each of the three needs; the `mapAttrs` fold applies
# every member's `.lib` — applied set or unapplied function alike — at this ONE site, so there
# is nowhere else in this file a mis-keyed application could be written.
members = {
algebra = inputs.gen-algebra.lib;
aspects = inputs.gen-aspects.lib;
bind = inputs.gen-bind.lib;
class = inputs.gen-class.lib;
dispatch = inputs.gen-dispatch.lib;
graph = inputs.gen-graph.lib;
identity = inputs.gen-identity.lib;
link = inputs.gen-link.lib;
memo = inputs.gen-memo.lib;
merge = inputs.gen-merge.lib;
prelude = inputs.gen-prelude.lib;
product = inputs.gen-product.lib;
schema = inputs.gen-schema.lib;
scope = inputs.gen-scope.lib;
select = inputs.gen-select.lib;
settings = inputs.gen-settings.lib;
types = inputs.gen-types.lib;
view = inputs.gen-view.lib;
};
# THE FOLD IS SELF-REFERENTIAL: `hubSubstrate.nix` reads `members // applied`, so an unapplied
# member (gen-inspect) can take another unapplied member (gen-program) APPLIED, and each is
# applied exactly once. `mapAttrs` needs only the file's key set, which its attrset literal
# supplies without forcing `members // applied`. See that file for the cycle hazard.
applied = builtins.mapAttrs (k: args: inputs."gen-${k}".lib args) (
import ./lib/hubSubstrate.nix (members // applied)
);
roster = import ./. (members // applied);
# The PUBLISHED two-stage surface, kept exactly as its consumers call it. Stage 2's argument
# was always vestigial — every caller passes `{ }`, `{ inherit lib; }` or `{ lib = null; }` and
# the roster ignores it — so the compat wrapper belongs here, at the publication site, while
# `lib/mkGenLibs.nix` is the construction and returns the roster itself. That is what lets
# `import <gen> { }` yield the roster directly while `gen.lib.mkGenLibs { … }` still answers
# for its thirteen call sites across this hub and gen-demo.
mkGenLibs = _: roster;
# A stratum bucket is a SELECTION from the flat roster, never a re-import: `substrate.prelude`
# and the flat `prelude` are one value rather than two evaluations of the same source. That
# distinction is invisible to a names-and-types comparison — a library re-imported at a
# different pin has identical names and identical types while being a different build — so it
# is the roster, not a reconstruction of it, that the buckets are cut from.
bucket =
s:
builtins.listToAttrs (
map (n: {
name = n;
value = roster.${n};
}) (builtins.filter (n: roster.strata.${n} == s) (builtins.attrNames roster.strata))
);
in
{
# `lib.mkCi` is NOT here, and its absence is the point rather than an omission: the CI
# wrapper is `gen-harness.lib.mkCi`, in its own repository. A library's test harness must
# not depend on the aggregator that pins that library, and re-exporting it from here was
# the last edge that made it.
lib.mkGenLibs = mkGenLibs;
# The successor compose (ADR-0031 F2's "compose S2 core → S2" row), bound against the
# roster: gen-merge as the engine, gen-memo's two decision functions as the plane. The
# construct itself (lib/compose.nix) binds no constructor vocabulary and takes `specialArgs`
# caller-total; a bare caller performs its own constructor threading, and the flakeModule
# below performs it for hub-fronted trees.
#
# INTERIM EXPOSURE. The construct is the settled S2 core, but this hub surface does NOT
# satisfy ADR-0027 — it is the same interim standing as `flakeModules.default` below, and
# the true framework surface that arrives with den v2 / quiver is what re-homes the
# exposure. Do not build a framework contract on top of the exposure's location.
lib.compose =
(import ./lib/compose.nix {
engine = roster.merge;
inherit (roster.memo) warmAdmits warmTrace;
}).compose;
# THE LIB-INSTANTIATED DOOR (ADR-0039 S4; den-hoag-6v35f C-i): the engine-bound part of this
# surface (`mkGenLibs`, `compose`, the four buckets) rebuilt over an engine instantiated with the
# caller's `lib`, from ONE construction. It is `./default.nix` with `lib` given and `src` answered
# by this flake's own resolved inputs, so it fetches nothing and a consumer's root-level
# `--override-input` reaches it; a nested `follows` on a member's own edge does not, since each
# edge is answered by the hub-level node (den-hoag-idhzc arm X). It is a separate constructor
# because `mkGenLibs`'s argument stays vestigial: giving it meaning would pair three of the callers
# that pass `{ inherit lib; }` with the no-lib `compose`, a mixed-engine state where a lib-built
# submodule is refused, and would move every such caller's roster value besides. Every
# binding sits inside the lambda, so a consumer that never applies it pays only the attribute.
# One application is one construction: bind the result once.
lib.instantiate =
{ lib }:
let
given = import ./. {
inherit lib;
src = segs: (builtins.foldl' (n: s: n.inputs.${s}) { inherit inputs; } segs).outPath;
};
over =
s:
builtins.listToAttrs (
map (n: {
name = n;
value = given.${n};
}) (builtins.filter (n: given.strata.${n} == s) (builtins.attrNames given.strata))
);
in
{
mkGenLibs = _: given;
compose =
(import ./lib/compose.nix {
engine = given.merge;
inherit (given.memo) warmAdmits warmTrace;
}).compose;
substrate = over "substrate";
modules = over "modules";
aspects = over "aspects";
framework = over "framework";
};
# The stack layers, each selected by the roster's own stratum declaration. The `retiring`
# declaration publishes no path here by design: inviting a consumer to select a library on its
# way off the roster is the adoption that value exists to prevent, and its members stay
# reachable through `mkGenLibs`.
#
# `framework` DOES publish, and the asymmetry with `retiring` is the point rather than an
# inconsistency. The two were once excluded by one sentence whose stated ground — a consumer
# selecting a leaving library — is true of `retiring` alone; a framework library is not
# leaving. What forced the reading is that a framework TOOLKIT is a library every assembling
# framework is meant to reach, so withholding its path made the intended consumption path the
# one case the hub does not serve.
lib.substrate = bucket "substrate";
lib.modules = bucket "modules";
lib.aspects = bucket "aspects";
lib.framework = bucket "framework";
flakeModules.genLibs = ./flakeModules/genLibs.nix;
# The flake-parts entry surface, rehomed from gen-flake under ADR-0031 F1 — the hub is the
# single input a consumer takes, so the ergonomics module belongs beside the roster it binds
# against. `default` is flake-parts' own convention and the name the source exported under, so
# a consumer's `imports = [ inputs.gen.flakeModules.default ]` reads unchanged.
#
# INTERIM. It does NOT satisfy ADR-0027; the true framework surface arrives with den v2 /
# quiver bound against that interface, and this module is what that replaces. The file header
# carries the marker and names the two measured defects that travelled with it unfixed
# (den-hoag-es9g).
flakeModules.default = ./flakeModules/default.nix;
# The flake-parts `evaluate` for gen-bind's outputs terminal (den-hoag-52hn7; ADR-0031 F1 and
# ADR-0027, re-affirmed 2026-09-28): gen-bind publishes `crossing.mkOutputsTerminal evaluate` in
# substrate vocabulary, and this is its one flake-parts binding — a CALLER of that construct,
# never a relocation of it. The consumer supplies flake-parts' own `evalFlakeModule`: this hub
# declares no flake-parts input because it evaluates none.
#
# INTERIM, the same standing as `flakeModules.default` above: it does NOT satisfy ADR-0027 and
# leaves with that surface when the den v2 framework surface arrives (den-hoag-es9g, which
# carries `flakeModules.default`'s INTERIM marker).
lib.flakePartsEvaluate =
{
evalFlakeModule,
inputs,
self,
systems ? [ ],
}:
body:
(evalFlakeModule
{
inputs = inputs // {
inherit self;
};
}
{
imports = body;
inherit systems;
}
).config.flake;
};
}