From e532acf863253c4be06ec95cf87937f77969dd0e Mon Sep 17 00:00:00 2001 From: Chris Hodapp Date: Mon, 26 Oct 2026 03:23:16 -0700 Subject: [PATCH 1/2] feat: wire deferred children, direct children and cross-child references; fix colmena nodes Configurations may declare deferred children: configurationsOptionsOf holds a deferred configuration as caisson-core's deferred entry, and publication skips it, since it passes nothing up at flake time. Every configuration gets caisson.forDirectChildren, and the three containers get unsafeCrossChildReferences, handed to caisson-core with the other additions. The upstream-compatible colmena integration built the nodes special argument from separate tops that inherited nothing from the colmena configuration and became per-system sets when several systems were in force. The colmena configuration now sets unsafeCrossChildReferences for its nearest NixOS configurations, and nodes are the nodes of its full evaluation. A configuration of an integration with a single output is named for that output: colmenaHive, formatter, topology. caisson-core is pinned to nix-caisson/caisson-core#57. Co-Authored-By: Claude Opus 5.5 --- README.md | 4 +- flake.lock | 6 +- lib-overlays/caisson-colmena/default.nix | 4 +- lib-overlays/colmena/default.nix | 40 ++++++---- lib-overlays/integrations/default.nix | 48 +++++++++--- lib-overlays/topology/default.nix | 4 +- lib-overlays/treefmt/default.nix | 18 ++--- modules/generic/core/caisson/default.nix | 1 + modules/generic/core/caisson/forChildren.nix | 22 ++++++ .../core/caisson/forDirectChildren.nix | 61 +++++++++++++++ .../core/caisson/forNearestChildren.nix | 26 +++++++ tests/dependencies/flake.lock | 6 +- tests/pinned-world/default.nix | 76 ++++++++++++------- tests/unit/lib-overlays.nix | 12 +-- 14 files changed, 249 insertions(+), 79 deletions(-) create mode 100644 modules/generic/core/caisson/forDirectChildren.nix diff --git a/README.md b/README.md index c202463..86ff1c0 100644 --- a/README.md +++ b/README.md @@ -134,10 +134,10 @@ source by. | `facter` | none | a `facter.json` as nixos-facter writes it, with the NixOS configurations that run on it declared inside it; a machine gets it as `hardware.facter.reportPath` | | `caisson-microvm` | `microvm` | microvm.nix guests declared inside the NixOS host that runs them, each guest a NixOS configuration declared inside it that sets its own `microvm.*` options and gets microvm.nix's guest module by default; the host selects caisson's `microvm-host` NixOS module, which defines microvm.nix's `microvm.vms.` from them; the microvm integration we recommend for new configurations | | `microvm` | `microvm` | a microvm.nix guest written as microvm.nix reads it, a NixOS configuration that sets its `microvm.*` options itself, declared inside the NixOS host that runs it; for porting an existing guest | -| `treefmt` | `treefmt-nix` | the formatters of a tree, as treefmt-nix modules; the configuration named `default` is published as the `formatter.` that `nix fmt` runs | +| `treefmt` | `treefmt-nix` | the formatters of a tree, as treefmt-nix modules; the configuration named `formatter` is published as the `formatter.` that `nix fmt` runs | | `nvf` | `nvf` | a Neovim written as nvf modules, published as `nvfConfigurations..`, in the shape `neovimConfiguration` returns, kept in a separate Nix profile that the machine, home-manager configuration or hjem configuration it is declared inside activates | | `nixvim` | `nixvim` | a Neovim written as nixvim modules, published as `nixvimConfigurations..`, kept in a profile as an nvf configuration is | -| `topology` | `nix-topology` | the diagram of the NixOS configurations declared inside it, as nix-topology renders it; the configuration named `default` is published as `topology.` | +| `topology` | `nix-topology` | the diagram of the NixOS configurations declared inside it, as nix-topology renders it; the configuration named `topology` is published as `topology.` | | `kubenix` | `kubenix` | Kubernetes resources written as kubenix modules, published as `kubenixConfigurations..`, the evaluation, whose `config.kubernetes.result` is the JSON `kubectl apply -f` reads | | `nixidy` | `nixidy` | an Argo CD environment written as nixidy modules, evaluated with nixidy's `mkEnv` and published as the `nixidyEnvs..` the nixidy CLI reads | | `system-manager` | `system-manager` | the systems of machines running another Linux distribution, published as the `systemConfigs` that `system-manager switch` reads; they activate the home-manager configurations and hjem configurations declared inside them, and the profiles of the nvf and nixvim configurations declared inside them | diff --git a/flake.lock b/flake.lock index ff1cfae..6f9e1f0 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "caisson-core": { "locked": { - "lastModified": 1792912516, - "narHash": "sha256-VRfoenyzsVr2fnxWJHXM4NvngUwWbbKldNg5sJkyXxA=", + "lastModified": 1793009381, + "narHash": "sha256-sSRHL2AYmw7or8vdj0CyxY03E8JXSKOSiAP8hrfnZS4=", "owner": "nix-caisson", "repo": "caisson-core", - "rev": "8f60ad78c9ad0980d61a87983fd13227038a2f8d", + "rev": "48aed2f22df2b35e07439c52e5e0e39038ca9234", "type": "github" }, "original": { diff --git a/lib-overlays/caisson-colmena/default.nix b/lib-overlays/caisson-colmena/default.nix index 56be18b..6939bd2 100644 --- a/lib-overlays/caisson-colmena/default.nix +++ b/lib-overlays/caisson-colmena/default.nix @@ -19,8 +19,8 @@ # `meta.nixpkgs`): every node is an evaluated NixOS configuration. # # A colmena configuration is published as `colmenaHive`, an output that -# holds a single value, so the configuration declared under the name -# `default` fills it. The nodes are published as well, as the NixOS +# holds a single value, so the configuration declared under the name of +# that output, `colmenaHive`, fills it. The nodes are published as well, as the NixOS # configurations they are, so `nixos-rebuild` and `colmena apply` build # the same machine. { diff --git a/lib-overlays/colmena/default.nix b/lib-overlays/colmena/default.nix index e891204..22fa700 100644 --- a/lib-overlays/colmena/default.nix +++ b/lib-overlays/colmena/default.nix @@ -16,10 +16,12 @@ # configuration the node also gets what caisson's NixOS evaluator gives # any configuration: the framework modules and the default selection. # -# `nodes` is what colmena hands its nodes: every node, evaluated again -# with type checking off, for one node to read another. A configuration -# never reads a sibling in the tree, so these evaluations are tops of -# their own, made only when a module reads them. +# `nodes` is what colmena hands its nodes: every node, for one node to +# read another. The colmena configuration sets +# `unsafeCrossChildReferences` for its nearest NixOS configurations, so +# each node reads the full evaluation of the colmena configuration and +# `nodes` is the nodes themselves. A loop among nodes that read each +# other is a Nix infinite recursion, as it is in colmena. # # The colmena configuration builds the hive from the NixOS # configurations it passes up, as caisson-colmena does, and is @@ -166,19 +168,31 @@ src: hive: { lib, ... }: let - # Every node again, with type checking off, for the `nodes` - # special argument. - uncheckedNodes = builtins.mapAttrs ( - name: _: - lib.caisson.nixos.mkTopConfiguration ( - nodeArgs src hive uncheckedNodes name [ { _module.check = false; } ] - ) - ) hive.nodes; + # The nodes as the `nodes` special argument: the NixOS + # configurations declared beneath this colmena configuration, + # each evaluated, from the full evaluation of this + # configuration. A node reads that evaluation through + # `unsafeCrossChildReferences`, set below, which records the + # read on each node; it is the configuration this module runs + # in, so its manifest here holds the same children. + full = lib.caisson-core.evalManifest; + nodes = + builtins.foldl' + ( + found: system: + found + // builtins.mapAttrs (_: node: node.value) (full.children.system.${system}.children.nixos or { }) + ) + (builtins.mapAttrs (_: node: node.value) (full.children.nixos or { })) + (builtins.attrNames (full.children.system or { })); in { meta = builtins.removeAttrs hive.meta evaluationMetaKeys; + # Colmena hands every node the other nodes, so the nodes read + # the full evaluation of this configuration. + caisson.forNearestChildren.unsafeCrossChildReferences.nixos = true; caisson.nixos.configurations = builtins.mapAttrs ( - name: _: lib.caisson.nixos.mkConfiguration (nodeArgs src hive uncheckedNodes name [ ]) + name: _: lib.caisson.nixos.mkConfiguration (nodeArgs src hive nodes name [ ]) ) hive.nodes; }; diff --git a/lib-overlays/integrations/default.nix b/lib-overlays/integrations/default.nix index b521f31..4b42767 100644 --- a/lib-overlays/integrations/default.nix +++ b/lib-overlays/integrations/default.nix @@ -830,11 +830,19 @@ extraDefaultModuleImports = additionsOf options.caisson.forChildren config.caisson.forChildren; defaultPkgs = config.caisson.forChildren.defaultPkgs; systems = config.caisson.forChildren.systems; + inherit (config.caisson.forChildren) unsafeCrossChildReferences; }; # What the modules give the nearest configurations of a # class beneath (`caisson.forNearestChildren`). forNearestChildren = { extraDefaultModuleImports = additionsOf options.caisson.forNearestChildren config.caisson.forNearestChildren; + inherit (config.caisson.forNearestChildren) unsafeCrossChildReferences; + }; + # What the modules give the configurations of a class + # declared directly beneath (`caisson.forDirectChildren`). + forDirectChildren = { + extraDefaultModuleImports = additionsOf options.caisson.forDirectChildren config.caisson.forDirectChildren; + inherit (config.caisson.forDirectChildren) unsafeCrossChildReferences; }; # What the evaluator received, as `declaration` events: # the integration's `evaluate` returns `modules`, the list @@ -1041,16 +1049,26 @@ finalize = childName: child: let - finalized = lib.caisson-core.finalizeChild { - name = childName; - what = what childName; - parent = manifest.childlessManifest; - } child; + # A deferred configuration is held as an entry, finalized + # when its args are supplied. + finalized = + ( + if lib.caisson-core.isDeferredConfiguration child then + lib.caisson-core.deferChild + else + lib.caisson-core.finalizeChild + ) + { + name = childName; + what = what childName; + parent = manifest.childlessManifest; + } + child; # The integration of what was declared: of the # manifest, or of the evaluations of a configuration # evaluated per system, null where it has none. declaredType = - if isManifest finalized then + if isManifest finalized || lib.caisson-core.isDeferred finalized then finalized.type else if finalized == { } then null @@ -1685,7 +1703,10 @@ name = system; }; beneath = - if isManifest finalized then + # A deferred child passes nothing up at flake time. + if final.caisson-core.isDeferred finalized then + [ ] + else if isManifest finalized then [ { prefix = [ (segmentOf name) ]; @@ -1736,8 +1757,8 @@ # paths. # # An output that holds a single value (`colmenaHive`) is the value - # of the entry named `default`, the entry whose `exportsTo` says - # `single`. Any other entry for that output is refused, since the + # of the entry named for that output, `colmenaHive`, the entry + # whose `exportsTo` says `single`. Any other entry for that output is refused, since the # output has no names to hold it under. # # An output whose entries' `exportsTo` says `bySystem` is keyed by @@ -1807,15 +1828,18 @@ name: builtins.length (builtins.filter (other: other == name) names) > 1 ) (unique names); single = builtins.any (entry: entry.single or false) members; - notDefault = builtins.filter (entry: (last entry.path).name != "default") members; + # A configuration with a single output is named for that + # output. + misnamed = builtins.filter (entry: (last entry.path).name != entry.attrset) members; + singleName = (builtins.head members).attrset; in if single then - if builtins.length members == 1 && notDefault == [ ] then + if builtins.length members == 1 && misnamed == [ ] then of (builtins.head members) else throw '' ${attrset}: this output holds a single value, the configuration - declared under the name `default`, but these configurations would + declared under the name `${singleName}`, but these configurations would be published there: ${builtins.concatStringsSep "\n" (builtins.map (entry: " ${showPath entry.path}") members)} '' diff --git a/lib-overlays/topology/default.nix b/lib-overlays/topology/default.nix index e11d2d4..460ca71 100644 --- a/lib-overlays/topology/default.nix +++ b/lib-overlays/topology/default.nix @@ -177,8 +177,8 @@ outputs.output = value.config.output; }; - # The configuration named `default` is published as - # `topology.`, the evaluation. + # The configuration named `topology`, for the output it fills, is + # published as `topology.`, the evaluation. exportsTo = { attrset = "topology"; single = true; diff --git a/lib-overlays/treefmt/default.nix b/lib-overlays/treefmt/default.nix index 177d242..7623127 100644 --- a/lib-overlays/treefmt/default.nix +++ b/lib-overlays/treefmt/default.nix @@ -157,27 +157,27 @@ }; }; - # Only the configuration named `default` is published: as - # `formatter.`, its wrapper, which `nix fmt` reads, and, - # in a tree that knows its root, as `checks..treefmt`, - # its check over that tree, which fails `nix flake check` when - # the tree is not formatted. - isDefault = manifest: (manifest.name or null) == "default"; + # Only the configuration named `formatter`, for the output it + # fills, is published: as `formatter.`, its wrapper, + # which `nix fmt` reads, and, in a tree that knows its root, as + # `checks..treefmt`, its check over that tree, which + # fails `nix flake check` when the tree is not formatted. + isFormatter = manifest: (manifest.name or null) == "formatter"; exportsTo = [ { attrset = "formatter"; single = true; bySystem = true; - only = isDefault; + only = isFormatter; value = manifest: manifest.outputs.wrapper; } { attrset = "checks"; bySystem = true; - only = manifest: isDefault manifest && (manifest.root or null) != null; + only = manifest: isFormatter manifest && (manifest.root or null) != null; name = _: { value = "treefmt"; - description = "named `treefmt`, the check of the configuration named `default`"; + description = "named `treefmt`, the check of the configuration named `formatter`"; }; value = manifest: manifest.outputs.check manifest.root; } diff --git a/modules/generic/core/caisson/default.nix b/modules/generic/core/caisson/default.nix index f3aa181..e535627 100644 --- a/modules/generic/core/caisson/default.nix +++ b/modules/generic/core/caisson/default.nix @@ -6,6 +6,7 @@ ./configurations.nix ./exports.nix ./forChildren.nix + ./forDirectChildren.nix ./forNearestChildren.nix ./libOverlays.nix ./modules.nix diff --git a/modules/generic/core/caisson/forChildren.nix b/modules/generic/core/caisson/forChildren.nix index 27834a5..34ebfcd 100644 --- a/modules/generic/core/caisson/forChildren.nix +++ b/modules/generic/core/caisson/forChildren.nix @@ -88,5 +88,27 @@ ''; }; + unsafeCrossChildReferences = lib.mkOption { + type = lib.types.attrsOf lib.types.bool; + default = { }; + example = { + nixos = true; + }; + description = '' + By class, whether the configurations of that class beneath this + configuration, at any depth, read the full evaluation of this + configuration, with its children, in place of the childless + view of their parent (`lib.caisson-core.evalManifest.crossChildLevel`). + They can then reach every configuration beneath this one, and + a loop between them is a Nix infinite recursion, which the + childless view otherwise rules out. + + A setting through `caisson.forDirectChildren` beats one through + `caisson.forNearestChildren`, which beats this one, and within + one container the nearest parent that sets it wins. This + reaches every depth, so it is rarely the one to use. + ''; + }; + }; } diff --git a/modules/generic/core/caisson/forDirectChildren.nix b/modules/generic/core/caisson/forDirectChildren.nix new file mode 100644 index 0000000..24d2531 --- /dev/null +++ b/modules/generic/core/caisson/forDirectChildren.nix @@ -0,0 +1,61 @@ +# SPDX-License-Identifier: MIT +# +# What this configuration gives the configurations of a class declared +# directly beneath it: additions to the default selection of that +# class, and whether they read the full evaluation of this +# configuration. A configuration evaluated per system and declared here +# is a direct child, since a system is no level of its own. Nothing +# here passes through a configuration of another class, and the +# configurations beneath a direct child do not get it. It is read from +# the childless view, which the configurations beneath are built +# against. +{ lib, ... }: +{ + options.caisson.forDirectChildren = { + + extraDefaultModuleImports = lib.mkOption { + type = lib.types.attrsOf (lib.types.functionTo (lib.types.listOf lib.types.raw)); + default = { }; + example = lib.literalExpression '' + { + nixos = lib: [ lib.caisson.modules.nixos.site-base ]; + } + ''; + description = '' + Additions to the default selection of a class for the + configurations of that class declared directly beneath this + configuration: by class, a function of the lib of such a + configuration returning registered modules. A direct child that + passes no `moduleImports` gets every entry named `default`, then + the additions of `caisson.forChildren.extraDefaultModuleImports` + of the levels above it, then those of + `caisson.forNearestChildren.extraDefaultModuleImports`, then + these. Definitions from several modules are concatenated. + + A module listed here is a module registered in the + composition, on `mkLib` or by a project. + ''; + }; + + unsafeCrossChildReferences = lib.mkOption { + type = lib.types.attrsOf lib.types.bool; + default = { }; + example = { + caisson-nixops4-resource = true; + }; + description = '' + By class, whether the configurations of that class declared + directly beneath this configuration read the full evaluation + of this configuration, with its children, in place of its + childless view (`lib.caisson-core.evalManifest.crossChildLevel`). + They can then reach every configuration beneath this one, and + a loop between them is a Nix infinite recursion, which the + childless view otherwise rules out. + + This setting beats one through `caisson.forNearestChildren` or + `caisson.forChildren`. + ''; + }; + + }; +} diff --git a/modules/generic/core/caisson/forNearestChildren.nix b/modules/generic/core/caisson/forNearestChildren.nix index c951d04..a1b7ceb 100644 --- a/modules/generic/core/caisson/forNearestChildren.nix +++ b/modules/generic/core/caisson/forNearestChildren.nix @@ -49,5 +49,31 @@ ''; }; + unsafeCrossChildReferences = lib.mkOption { + type = lib.types.attrsOf lib.types.bool; + default = { }; + example = { + nixos = true; + }; + description = '' + By class, whether the nearest configurations of that class + beneath this configuration read the full evaluation of this + configuration, with its children, in place of the childless + view of their parent (`lib.caisson-core.evalManifest.crossChildLevel`). + It passes through configurations of other classes, as the + additions above do, so a machine inside a structural group or a + disk layout beneath this configuration is reached. A + configuration it reaches can read every configuration beneath + this one, and a loop between them is a Nix infinite recursion, + which the childless view otherwise rules out. + + A setting through `caisson.forDirectChildren` beats this one, + which beats one through `caisson.forChildren`, and within one + container the nearest parent that sets it wins. This setting + connects at the nearest configurations of its class whether or + not it wins there. + ''; + }; + }; } diff --git a/tests/dependencies/flake.lock b/tests/dependencies/flake.lock index 0cd1921..ad1dbd4 100644 --- a/tests/dependencies/flake.lock +++ b/tests/dependencies/flake.lock @@ -2,11 +2,11 @@ "nodes": { "caisson-core": { "locked": { - "lastModified": 1792912516, - "narHash": "sha256-VRfoenyzsVr2fnxWJHXM4NvngUwWbbKldNg5sJkyXxA=", + "lastModified": 1793009381, + "narHash": "sha256-sSRHL2AYmw7or8vdj0CyxY03E8JXSKOSiAP8hrfnZS4=", "owner": "nix-caisson", "repo": "caisson-core", - "rev": "8f60ad78c9ad0980d61a87983fd13227038a2f8d", + "rev": "48aed2f22df2b35e07439c52e5e0e39038ca9234", "type": "github" }, "original": { diff --git a/tests/pinned-world/default.nix b/tests/pinned-world/default.nix index 8b22eed..95072ca 100644 --- a/tests/pinned-world/default.nix +++ b/tests/pinned-world/default.nix @@ -344,7 +344,7 @@ let # The manifest of the disko configuration `nas-1` of a `layoutTop`. layoutManifest = integration: top: top.caisson.manifest.children.${integration}.nas-1; - # A top holding a colmena configuration named `default`, with a NixOS + # A top holding a colmena configuration named `colmenaHive`, with a NixOS # configuration declared inside it for each machine given, by name. # `machineArgs` are further arguments of each machine's constructor. # The colmena configuration disallows a bare `colmena apply`. @@ -355,7 +355,7 @@ let configModule = { lib, ... }: { - caisson.caisson-colmena.configurations.default = lib.caisson.caisson-colmena.mkConfiguration { + caisson.caisson-colmena.configurations.colmenaHive = lib.caisson.caisson-colmena.mkConfiguration { pkgSets.pkgs = pkgs; configModule = { lib, ... }: @@ -495,13 +495,13 @@ let }; # A top holding the upstream hive as a colmena configuration named - # `default`. + # `colmenaHive`. upstreamHiveTop = hiveLib.caisson.structural.mkTopConfiguration { moduleImports = _modules: [ ]; configModule = { lib, ... }: { - caisson.colmena.configurations.default = lib.caisson.colmena.mkConfiguration { + caisson.colmena.configurations.colmenaHive = lib.caisson.colmena.mkConfiguration { hive = upstreamHive; }; }; @@ -781,7 +781,7 @@ let configModule = { lib, ... }: { - caisson.caisson-colmena.configurations.default = lib.caisson.caisson-colmena.mkConfiguration { + caisson.caisson-colmena.configurations.colmenaHive = lib.caisson.caisson-colmena.mkConfiguration { ecosystemSrc = sources: { }; }; }; @@ -1016,8 +1016,8 @@ let upstreamHive = [ "top: inline/2" ]; colmena = [ "top: inline/2" - "caisson-colmena default: inline/4" - "caisson-colmena default / system x86_64-linux / nixos probe-node: inline/5" + "caisson-colmena colmenaHive: inline/4" + "caisson-colmena colmenaHive / system x86_64-linux / nixos probe-node: inline/5" ]; caissonDisko = [ "top: inline/2" @@ -1237,9 +1237,10 @@ let source = "nixpkgs"; }; colmena = - (colmenaTop { probe-node = minimalNixosBase; }).caisson.manifest.children.caisson-colmena.default; + (colmenaTop { probe-node = minimalNixosBase; }) + .caisson.manifest.children.caisson-colmena.colmenaHive; node = colmena.children.system.x86_64-linux.children.nixos.probe-node; - upstreamColmena = upstreamHiveTop.caisson.manifest.children.colmena.default; + upstreamColmena = upstreamHiveTop.caisson.manifest.children.colmena.colmenaHive; caissonDisko = layoutManifest "caisson-disko" (layoutTop { integration = "caisson-disko"; layout = luksLvmLayout; @@ -1588,7 +1589,7 @@ let && !(hiveLib.caisson.caisson-disko ? mkTopConfiguration) && !(hiveLib.caisson.disko ? mkTopConfiguration); - # A colmena configuration declared under the name `default` beneath + # A colmena configuration declared under the name `colmenaHive` beneath # a top fills the top's `colmenaHive`. Its nodes are the NixOS # configurations declared inside it, which the top also publishes # as `nixosConfigurations`, so the hive and the published machine @@ -1727,7 +1728,7 @@ let configModule = { lib, ... }: { - caisson.caisson-colmena.configurations.default = lib.caisson.caisson-colmena.mkConfiguration { + caisson.caisson-colmena.configurations.colmenaHive = lib.caisson.caisson-colmena.mkConfiguration { configModule = { lib, ... }: { @@ -1771,7 +1772,7 @@ let configModule = { lib, ... }: { - caisson.caisson-colmena.configurations.default = lib.caisson.caisson-colmena.mkConfiguration { + caisson.caisson-colmena.configurations.colmenaHive = lib.caisson.caisson-colmena.mkConfiguration { ecosystemSrc = _sources: ecosystemSrc; configModule = { lib, ... }: @@ -1805,7 +1806,7 @@ let configModule = { lib, ... }: { - caisson.caisson-colmena.configurations.default = lib.caisson.caisson-colmena.mkConfiguration { + caisson.caisson-colmena.configurations.colmenaHive = lib.caisson.caisson-colmena.mkConfiguration { configModule = { lib, ... }: { @@ -1878,7 +1879,7 @@ let configModule = { lib, ... }: { - caisson.caisson-colmena.configurations.default = lib.caisson.caisson-colmena.mkConfiguration { + caisson.caisson-colmena.configurations.colmenaHive = lib.caisson.caisson-colmena.mkConfiguration { configModule = { lib, ... }: { @@ -1944,7 +1945,7 @@ let configModule = { lib, ... }: { - caisson.caisson-colmena.configurations.default = lib.caisson.caisson-colmena.mkConfiguration { + caisson.caisson-colmena.configurations.colmenaHive = lib.caisson.caisson-colmena.mkConfiguration { configModule = { lib, ... }: { @@ -2021,6 +2022,27 @@ let && hive.nodes.alpha.pkgs.hello.drvPath == pkgs.hello.drvPath && top.nixosConfigurations.beta.config.networking.hostName == "beta"; + # `nodes` is the nodes themselves: the NixOS configurations declared + # beneath the colmena configuration, read from its full evaluation + # (`unsafeCrossChildReferences`), not second evaluations made apart + # from the tree. Each node records the colmena configuration as the + # level whose children it reads. + colmenaUpstreamNodesAreTheNodes = + let + colmena = upstreamHiveTop.caisson.manifest.children.colmena.colmenaHive; + alpha = colmena.children.system.x86_64-linux.children.nixos.alpha; + in + alpha.crossChildLevel != null + && !alpha.crossChildLevel.childless + && alpha.crossChildLevel.name == "colmenaHive" + && + alpha.crossChildLevelPath == [ + { + type = "colmena"; + name = "colmenaHive"; + } + ]; + # A node of the upstream-compatible integration builds the same # system as colmena builds from the same hive. colmenaUpstreamHiveBuildsWhatColmenaBuilds = @@ -2032,9 +2054,9 @@ let && hive.toplevel.beta.drvPath == upstream.toplevel.beta.drvPath; # `colmenaHive` holds a single value, so only a colmena - # configuration declared under the name `default` is published - # there. - colmenaHiveIsTheDefaultConfiguration = + # configuration declared under the name of that output, + # `colmenaHive`, is published there. + colmenaHiveIsTheConfigurationNamedForIt = !(builtins.tryEval (hiveLib.caisson.structural.mkTopConfiguration { moduleImports = _modules: [ ]; @@ -2307,7 +2329,7 @@ let configModule = { lib, ... }: { - caisson.caisson-colmena.configurations.default = lib.caisson.caisson-colmena.mkConfiguration { + caisson.caisson-colmena.configurations.colmenaHive = lib.caisson.caisson-colmena.mkConfiguration { configModule = { lib, ... }: { @@ -2360,7 +2382,7 @@ let configModule = { lib, ... }: { - caisson.caisson-colmena.configurations.default = lib.caisson.caisson-colmena.mkConfiguration { + caisson.caisson-colmena.configurations.colmenaHive = lib.caisson.caisson-colmena.mkConfiguration { configModule = { lib, ... }: { @@ -2739,7 +2761,7 @@ let configModule = { lib, ... }: { - caisson.caisson-colmena.configurations.default = lib.caisson.caisson-colmena.mkConfiguration { + caisson.caisson-colmena.configurations.colmenaHive = lib.caisson.caisson-colmena.mkConfiguration { configModule = { lib, ... }: { @@ -3351,7 +3373,7 @@ let ]; }).hash; - # A treefmt configuration declared under the name `default` is + # A treefmt configuration declared under the name `formatter` is # published as `formatter.`, and its wrapper is the # derivation treefmt-nix's own `mkWrapper` builds from the same # module on the same package set. Its outputs carry the @@ -3368,7 +3390,7 @@ let declares = { lib, ... }: { - caisson.treefmt.configurations.default = lib.caisson.treefmt.mkConfiguration { + caisson.treefmt.configurations.formatter = lib.caisson.treefmt.mkConfiguration { ecosystemSrc = sources: sources.treefmt-nix; configModule = module; }; @@ -3401,8 +3423,8 @@ let configModule = declares; }; children = top.caisson.manifest.children.system.x86_64-linux.children.treefmt; - evaluation = children.default; - rootedEvaluation = rooted.caisson.manifest.children.system.x86_64-linux.children.treefmt.default; + evaluation = children.formatter; + rootedEvaluation = rooted.caisson.manifest.children.system.x86_64-linux.children.treefmt.formatter; upstream = inputs.treefmt-nix.lib.mkWrapper pkgs module; in builtins.attrNames top.formatter == [ "x86_64-linux" ] @@ -3635,7 +3657,7 @@ let configModule = { lib, ... }: { - caisson.topology.configurations.default = lib.caisson.topology.mkConfiguration { + caisson.topology.configurations.topology = lib.caisson.topology.mkConfiguration { ecosystemSrc = sources: sources.nix-topology; configModule = { lib, ... }: @@ -3672,7 +3694,7 @@ let ]; }; topology = top.topology.x86_64-linux; - evaluation = top.caisson.manifest.children.system.x86_64-linux.children.topology.default; + evaluation = top.caisson.manifest.children.system.x86_64-linux.children.topology.topology; in builtins.attrNames top.nixosConfigurations == [ "alpha" diff --git a/tests/unit/lib-overlays.nix b/tests/unit/lib-overlays.nix index 5af7a31..9c1dcda 100644 --- a/tests/unit/lib-overlays.nix +++ b/tests/unit/lib-overlays.nix @@ -3267,11 +3267,11 @@ in (entryFor "aarch64-linux" "a" { }) ]; single = publish [ - (entryFor "x86_64-linux" "default" { + (entryFor "x86_64-linux" "formatter" { attrset = "formatter"; single = true; }) - (entryFor "aarch64-linux" "default" { + (entryFor "aarch64-linux" "formatter" { attrset = "formatter"; single = true; }) @@ -3290,8 +3290,8 @@ in aarch64-linux.a = "a for aarch64-linux"; }; single.formatter = { - x86_64-linux = "default for x86_64-linux"; - aarch64-linux = "default for aarch64-linux"; + x86_64-linux = "formatter for x86_64-linux"; + aarch64-linux = "formatter for aarch64-linux"; }; withoutSystem = true; }; @@ -5735,7 +5735,7 @@ in expected = builtins.functionArgs lib.caisson.nixos.mkConfiguration; }; - # A colmena configuration declared under the name `default` fills + # A colmena configuration declared under the name `colmenaHive` fills # the `colmenaHive` of the top it is declared beneath, an output # that holds a single value: the hive, with the colmena # configuration's `meta` and no nodes when no NixOS configuration @@ -5749,7 +5749,7 @@ in configModule = { lib, ... }: { - caisson.caisson-colmena.configurations.default = lib.caisson.caisson-colmena.mkConfiguration { + caisson.caisson-colmena.configurations.colmenaHive = lib.caisson.caisson-colmena.mkConfiguration { ecosystemSrc = _sources: colmenaStub; configModule.meta.description = "probe"; }; From c0660d8de52f64ca2e82fdaef14705948870a979 Mon Sep 17 00:00:00 2001 From: Chris Hodapp Date: Wed, 28 Oct 2026 20:20:11 -0700 Subject: [PATCH 2/2] maint: pin caisson-core main with the deferred configurations Co-Authored-By: Claude Opus 5.5 --- flake.lock | 6 +++--- tests/dependencies/flake.lock | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 6f9e1f0..21d0d65 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "caisson-core": { "locked": { - "lastModified": 1793009381, - "narHash": "sha256-sSRHL2AYmw7or8vdj0CyxY03E8JXSKOSiAP8hrfnZS4=", + "lastModified": 1793243975, + "narHash": "sha256-OzlG2Nhl/kU2UUPq+ARH/GKUHmOqAxQu5Ug/+aT1ECc=", "owner": "nix-caisson", "repo": "caisson-core", - "rev": "48aed2f22df2b35e07439c52e5e0e39038ca9234", + "rev": "6868bca2682e96d56714bc9c9adcf0048fbe132f", "type": "github" }, "original": { diff --git a/tests/dependencies/flake.lock b/tests/dependencies/flake.lock index ad1dbd4..77798be 100644 --- a/tests/dependencies/flake.lock +++ b/tests/dependencies/flake.lock @@ -2,11 +2,11 @@ "nodes": { "caisson-core": { "locked": { - "lastModified": 1793009381, - "narHash": "sha256-sSRHL2AYmw7or8vdj0CyxY03E8JXSKOSiAP8hrfnZS4=", + "lastModified": 1793243975, + "narHash": "sha256-OzlG2Nhl/kU2UUPq+ARH/GKUHmOqAxQu5Ug/+aT1ECc=", "owner": "nix-caisson", "repo": "caisson-core", - "rev": "48aed2f22df2b35e07439c52e5e0e39038ca9234", + "rev": "6868bca2682e96d56714bc9c9adcf0048fbe132f", "type": "github" }, "original": {