From fd93d8f337c3a19a5dfe29c019f55c22e42db631 Mon Sep 17 00:00:00 2001 From: Chris Hodapp Date: Sat, 17 Oct 2026 02:20:24 -0700 Subject: [PATCH 1/5] perf(core): declare the module export settings as one option Every evaluation declared `caisson.modules..export.enabled` and `caisson.modules..exported` as options for every registered class. `caisson.modules` is now one option, an attribute set by class of the two settings, so a class no module sets costs nothing to evaluate. The definitions are written as before; a class with no registered module, or a setting other than the two, is refused when the exports are read. `exported` is now a value, so two definitions of it for one class conflict instead of merging. Co-Authored-By: Claude Opus 5.5 --- modules/generic/core/caisson/modules.nix | 107 +++++++++++++---------- 1 file changed, 59 insertions(+), 48 deletions(-) diff --git a/modules/generic/core/caisson/modules.nix b/modules/generic/core/caisson/modules.nix index 790bc974..2930a6bf 100644 --- a/modules/generic/core/caisson/modules.nix +++ b/modules/generic/core/caisson/modules.nix @@ -2,7 +2,6 @@ { config, lib, - options, ... }: let @@ -20,65 +19,77 @@ let # The classes that have a registered module, in the registry of the # library and in the registry the manifest of this evaluation holds. # Both manifests are in the library, so the classes are known before - # this evaluation starts. The export settings of each class are - # declared as options from this list. A setting for a class that is - # not in the list is refused as an option that does not exist. + # this evaluation starts. A setting for a class that is not in the + # list is refused. evalManifest = lib.caisson-core.evalManifest; classes = lib.lists.unique ( builtins.attrNames lib.caisson.modules ++ builtins.attrNames (if evalManifest == null then { } else evalManifest.modules or { }) ); - # The types of the options, built once for every class. The modules - # are exported as they were registered. - types = { - enabled = lib.types.bool; - exported = lib.types.functionTo (lib.types.lazyAttrsOf lib.types.raw); - }; - - # True when a module of the evaluation defines the option: its highest - # priority is above the priority of an option default. - defined = option: option.highestPrio < 1500; + settings = config.caisson.modules; + unknown = builtins.filter (class: !(builtins.elem class classes)) (builtins.attrNames settings); + settingsNames = [ + "export" + "exported" + ]; - # A class whose options no module defines exports its default, the - # modules the composition registers itself, without merging the two - # options, which spares merging them in every evaluation for every - # class. - exportedClassModules = builtins.mapAttrs ( - class: classModules: + # The settings of a class: `export.enabled`, true unless set, and + # `exported`, the function that selects the modules to export, the + # modules the composition registers itself unless set. + settingsOf = + class: let - classOptions = options.caisson.modules.${class}; - classConfig = config.caisson.modules.${class}; + set = settings.${class} or { }; + others = builtins.filter (name: !(builtins.elem name settingsNames)) (builtins.attrNames set); + enabled = (set.export or { }).enabled or true; in - if !(defined classOptions.export.enabled) && !(defined classOptions.exported) then - localModules class classModules - else if classConfig.export.enabled then - classConfig.exported classModules + if others != [ ] then + throw "`caisson.modules.${class}` sets ${lib.concatStringsSep ", " others}; the settings of a class are `export.enabled` and `exported`." + else if !builtins.isBool enabled then + throw "`caisson.modules.${class}.export.enabled` must be a boolean." else - { } - ) registeredModules; + { + inherit enabled; + exported = set.exported or (localModules class); + }; + + exportedClassModules = + if unknown != [ ] then + throw '' + `caisson.modules` sets the export of ${lib.concatMapStringsSep ", " (class: "`${class}`") unknown}, + which no module is registered for. The classes are: ${lib.concatStringsSep ", " classes}. + '' + else + builtins.mapAttrs ( + class: classModules: + let + classSettings = settingsOf class; + in + if classSettings.enabled then classSettings.exported classModules else { } + ) registeredModules; in { - options.caisson.modules = lib.genAttrs classes (class: { - export.enabled = lib.mkOption { - type = types.enabled; - default = true; - description = "Whether to export the modules of the class `${class}`."; - }; - exported = lib.mkOption { - type = types.exported; - default = localModules class; - defaultText = lib.literalMD "the modules of the class this composition registers itself"; - description = '' - Function that selects which registered modules of the class - `${class}` to export. Receives the modules registered for the - class and returns the modules to export. Defaults to the - modules this composition registers itself. A module that came - from an entry of `projects`, registered as `/`, - is exported only when the function names it. - ''; - }; - }); + # The export settings of each class, in one option for every class: + # a class no module sets costs nothing to evaluate, where options per + # class would be merged in every evaluation for every class, and a + # submodule per class would be an evaluation of its own. + options.caisson.modules = lib.mkOption { + type = lib.types.lazyAttrsOf (lib.types.lazyAttrsOf lib.types.raw); + default = { }; + description = '' + The export settings of the registered modules, by class. + `caisson.modules..exported` is the function that selects + which registered modules of the class to export: it receives the + modules registered for the class and returns the modules to + export. It defaults to the modules this composition registers + itself; a module that came from an entry of `projects`, + registered as `/`, is exported only when the + function names it. `caisson.modules..export.enabled`, + true unless set, turns the export of the class off. A class with + a registered module can be set; any other class is refused. + ''; + }; config.caisson.exports.modules = exportedClassModules; } From 3c16421107cbb7be7f0b3f390ed7020c83117d1a Mon Sep 17 00:00:00 2001 From: Chris Hodapp Date: Sat, 17 Oct 2026 02:29:15 -0700 Subject: [PATCH 2/5] feat: add the topology, kubenix and nixidy integrations A topology configuration is the diagram of the NixOS configurations declared inside it. caisson evaluates nix-topology's `topology` modules on the composed library and the selected package set extended with nix-topology's packages, with `nixosConfigurations` set to the machines declared inside it at its system; those machines get nix-topology's NixOS module by default. The configuration named `default` is published as `topology.`, where nix-topology's flake module publishes it. A kubenix configuration is Kubernetes resources written as kubenix modules, evaluated as kubenix's `evalModules` evaluates them, on the composed library extended with kubenix's `upstreamables.nix`. Its `result` is published as `packages..`. A nixidy configuration is an Argo CD environment, evaluated with nixidy's own `mkEnv` over the composed library, with the namespaces of the composed library added to nixidy's through `libOverlay`. It is published as `nixidyEnvs..`, which the nixidy CLI reads. The pinned-world suite checks each against its upstream evaluator: the same topology nodes and diagram, the same kubenix result and the same nixidy environment. Co-Authored-By: Claude Opus 5.5 --- README.md | 3 + configs/structural/impl/default.nix | 3 + docs/development/repository-structure.md | 3 +- lib-overlays/kubenix/default.nix | 239 +++++++++++++++++ lib-overlays/nixidy/default.nix | 202 +++++++++++++++ lib-overlays/topology/default.nix | 238 +++++++++++++++++ modules/generic/core/default.nix | 3 + modules/kubenix/core | 1 + modules/nixidy/core | 1 + modules/topology/core | 1 + tests/argument-errors/check.sh | 3 + tests/dependencies/flake.lock | 310 +++++++++++++++++++++-- tests/dependencies/flake.nix | 6 + tests/pinned-world/default.nix | 136 ++++++++++ tests/unit/lib-overlays.nix | 9 + 15 files changed, 1139 insertions(+), 19 deletions(-) create mode 100644 lib-overlays/kubenix/default.nix create mode 100644 lib-overlays/nixidy/default.nix create mode 100644 lib-overlays/topology/default.nix create mode 120000 modules/kubenix/core create mode 120000 modules/nixidy/core create mode 120000 modules/topology/core diff --git a/README.md b/README.md index 565fbf9b..42f4f7fa 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,9 @@ source by. | `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 | | `nvf` | `nvf` | a Neovim written as nvf modules, published as `nvfConfigurations..`, in the shape `neovimConfiguration` returns | | `nixvim` | `nixvim` | a Neovim written as nixvim modules, published as `nixvimConfigurations..` | +| `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.` | +| `kubenix` | `kubenix` | Kubernetes resources written as kubenix modules, published as `packages..`, 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 | | `structural` | none | a configuration that only exports and holds configurations beneath it: the top of a repository whose point is what it exports, such as caisson itself, or a layer at any depth | diff --git a/configs/structural/impl/default.nix b/configs/structural/impl/default.nix index 5a685db1..a3b0487c 100644 --- a/configs/structural/impl/default.nix +++ b/configs/structural/impl/default.nix @@ -37,6 +37,9 @@ treefmt nvf nixvim + topology + kubenix + nixidy ; }; diff --git a/docs/development/repository-structure.md b/docs/development/repository-structure.md index 5036c220..07e439ee 100644 --- a/docs/development/repository-structure.md +++ b/docs/development/repository-structure.md @@ -28,7 +28,8 @@ The layer users reach for: the integrations (`structural`, `flake-parts`, `nixpkgs`, `nixos`, `nixos-minimal`, `home-manager`, `home-manager-minimal`, `darwin`, `hjem`, `caisson-colmena`, `colmena`, `caisson-disko`, `disko`, `caisson-facter`, `facter`, `terranix`, -`system-manager`, `treefmt`, `nvf`, `nixvim`), each +`system-manager`, `treefmt`, `nvf`, `nixvim`, `topology`, `kubenix`, +`nixidy`), each a library overlay contributing its `lib.caisson` namespace, registering its module class where it has a class (`nixos-minimal` and `home-manager-minimal` diff --git a/lib-overlays/kubenix/default.nix b/lib-overlays/kubenix/default.nix new file mode 100644 index 00000000..530e8368 --- /dev/null +++ b/lib-overlays/kubenix/default.nix @@ -0,0 +1,239 @@ +# SPDX-License-Identifier: MIT +# +# The kubenix integration: it owns the `kubenix` class, the class of +# kubenix's modules. A kubenix configuration is a set of Kubernetes +# resources written as kubenix modules, which import the kubenix modules +# they use from the `kubenix` argument (`kubenix.modules.k8s`). It is +# evaluated at every system in force where it is declared, on the +# package set selected for it. +# +# kubenix evaluates its modules with its `evalModules`: `evalModules` on +# the library of the package set extended with kubenix's +# `upstreamables.nix`, with the special argument `kubenix` holding its +# library, its `evalModules` and its modules. caisson makes that +# evaluation on the composed library extended the same way. +# +# The output is `result`, the resources as a JSON file, which +# `kubectl apply -f` reads; it is the `kubernetes.result` of kubenix's +# `k8s` module, so a configuration that imports that module has it. A +# configuration is published as `packages..`, its result. +{ + mkLibOverlay, + ... +}: +{ + + imports = [ + # The library of nixpkgs, which this overlay calls through the + # composed library, imported by key so it is composed wherever + # this is. + ((mkLibOverlay ../nixpkgs-lib) // { key = "nixpkgs-lib"; }) + # What an integration is written from, imported by key so it is + # composed wherever this integration is. + ((mkLibOverlay ../integrations) // { key = "integrations"; }) + ]; + + overlay = + final: prev: + let + context = "lib.caisson.kubenix.mkConfiguration"; + + resolveEcosystemSrc = final.caisson.integrations.resolveEcosystemSrc { + name = "kubenix"; + context = "caisson.kubenix"; + }; + + # A kubenix source: the kubenix flake or source tree, which holds + # its library at `lib` and its modules at `modules`. + assertKubenixSrc = + ecosystemSrc: + let + path = if builtins.isAttrs ecosystemSrc then ecosystemSrc.outPath or null else ecosystemSrc; + in + if + path != null + && builtins.pathExists "${path}/lib/upstreamables.nix" + && builtins.pathExists "${path}/lib/eval-modules.nix" + && builtins.pathExists "${path}/modules/default.nix" + then + ecosystemSrc + else + throw "${context} requires `ecosystemSrc` to be a kubenix flake or source tree (holding lib/upstreamables.nix, lib/eval-modules.nix and modules)."; + + evaluate = + args: + { lib, manifest }: + let + selection = lib.caisson.integrations; + src = assertKubenixSrc (resolveEcosystemSrc { + explicit = args.ecosystemSrc or null; + manifest = lib.caisson-core.libManifest or { }; + }); + + name = manifest.name or null; + inherit (manifest) system; + what = + if name != null then + "the kubenix configuration `${name}` at ${system}" + else + "this kubenix configuration at ${system}"; + + pkgSets = selection.pkgSetsAt { inherit context what; } manifest system; + pkgs = selection.pkgSetOf { inherit context what; } manifest pkgSets; + + # The composed library extended with kubenix's + # `upstreamables.nix`, as kubenix extends the library of the + # package set. `extend` extends the library of nixpkgs, so the + # composed library is laid over it again, with the module + # system of the extension. + kubenixLib = lib.extend ( + self: super: + lib + // { + inherit (super) modules types evalModules; + } + // import "${src}/lib/upstreamables.nix" { + lib = self; + inherit pkgs; + } + ); + + registry = lib.caisson.modules.kubenix or { }; + frameworkModules = selection.frameworkModules "kubenix" registry; + moduleImports = selection.moduleImportsOf "kubenix" { inherit lib manifest; } args; + + # The configuration's module: the module passed, else the + # configuration registered under the configuration's name + # (`configs/kubenix/`), else none. + registered = lib.caisson.configs.kubenix or { }; + configModule = + if (args.configModule or null) != null then + args.configModule + else if name != null then + registered.${name} or null + else + null; + + value = kubenixLib.evalModules ( + { + class = "kubenix"; + specialArgs = { + inherit pkgs pkgSets; + lib = kubenixLib; + kubenix = { + lib = import "${src}/lib" { + inherit pkgs; + inherit (pkgs) lib; + }; + evalModules = import "${src}/lib/eval-modules.nix" { inherit pkgs; }; + modules = import "${src}/modules"; + }; + } + // (if (args.specialArgs or null) != null then args.specialArgs else { }); + modules = + frameworkModules + ++ moduleImports registry + ++ (if configModule == null then [ ] else [ configModule ]) + ++ [ + { + _file = "caisson-kubenix:args"; + config._module.args = { + inherit pkgs; + name = "default"; + }; + } + ]; + } + // (if (args.ecosystemArgs or null) != null then args.ecosystemArgs else { }) + ); + in + { + inherit value; + outputs.result = + value.config.kubernetes.result + or (throw "${what} has no `kubernetes.result`; it imports kubenix's `k8s` module from `kubenix.modules.k8s` to have one."); + }; + + # A kubenix configuration is published as + # `packages..`, its result. + exportsTo = { + attrset = "packages"; + bySystem = true; + value = manifest: manifest.outputs.result; + }; + + configuration = + args: + final.caisson.integrations.mkModuleConfiguration { + type = "kubenix"; + # A kubenix configuration is evaluated at a system: it has an + # evaluation for every system in force where it is declared. + perSystem = true; + defaultPkgs = args.defaultPkgs or null; + inherit exportsTo; + evaluate = evaluate args; + }; + + integration = final.caisson.integrations.mkIntegration { + name = "kubenix"; + class = "kubenix"; + # A kubenix configuration that is a top, as a tool reads it: the + # evaluation, or the evaluations by system where several are in + # force. + top = final.caisson.integrations.topValue; + # What these return is a configuration, a function of + # `{ name, parent }`: a parent that declares it under + # `caisson.kubenix.configurations.` finalizes it, and + # `mkTopConfiguration` finalizes it at a top. + mkConfiguration = + { + # The configuration's module. When absent, the configuration + # registered under the configuration's name + # (`lib.caisson.configs.kubenix.`), if any. Further + # modules of the class are selected with `moduleImports`, + # from the registry. + configModule ? null, + # The kubenix flake or source tree; resolved from the + # composition's declarations when absent. + ecosystemSrc ? null, + # The package set the configuration runs on: a function + # that receives the package sets available where it is + # declared, by package config name, each at the system of + # the evaluation, and returns the set to run on. When + # absent, the selection of the nearest configuration above, + # and the set named `default` where none above selects. + defaultPkgs ? null, + # The selection over the kubenix class of the registry. It + # replaces the default of the class, which is every entry + # named `default` followed by what the configurations + # above added. + moduleImports ? null, + # A selection added to that selection, whichever it is. + extraModuleImports ? null, + # Extra module arguments, merged over those the framework + # supplies. + specialArgs ? null, + }@args: + configuration args; + # The same arguments and `ecosystemArgs`, the evaluator's + # arguments merged over the composed call last. + mkConfigurationWithEcosystemArgs = + { + configModule ? null, + ecosystemSrc ? null, + defaultPkgs ? null, + moduleImports ? null, + extraModuleImports ? null, + specialArgs ? null, + ecosystemArgs ? null, + }@args: + configuration args; + }; + in + { + caisson = (prev.caisson or { }) // { + kubenix = integration.namespace; + }; + }; + +} diff --git a/lib-overlays/nixidy/default.nix b/lib-overlays/nixidy/default.nix new file mode 100644 index 00000000..1f31b393 --- /dev/null +++ b/lib-overlays/nixidy/default.nix @@ -0,0 +1,202 @@ +# SPDX-License-Identifier: MIT +# +# The nixidy integration: it owns the `nixidy` class, the class of +# nixidy's modules. A nixidy configuration is an environment of Argo CD +# applications, written as nixidy modules (`applications.*`, +# `nixidy.target`). It is evaluated at every system in force where it +# is declared, on the package set selected for it. +# +# caisson evaluates it with nixidy's own `mkEnv`, the function the +# nixidy flake publishes as `lib.mkEnv`. `mkEnv` runs the module system +# of the library it is given, here the composed library, and gives the +# modules nixidy's library extended by its `libOverlay`, here the +# namespaces of the composed library that nixidy's library does not +# have, such as `caisson`. nixidy returns the evaluated configuration +# and its packages but not its options, so a nixidy configuration holds +# no configurations beneath it. +# +# The outputs are nixidy's packages: `environmentPackage`, the +# rendered manifests, `activationPackage` and `bootstrapPackage`. A +# configuration is published as `nixidyEnvs..`, which the +# nixidy CLI reads. +{ + mkLibOverlay, + ... +}: +{ + + imports = [ + # The library of nixpkgs, which this overlay calls through the + # composed library, imported by key so it is composed wherever + # this is. + ((mkLibOverlay ../nixpkgs-lib) // { key = "nixpkgs-lib"; }) + # What an integration is written from, imported by key so it is + # composed wherever this integration is. + ((mkLibOverlay ../integrations) // { key = "integrations"; }) + ]; + + overlay = + final: prev: + let + context = "lib.caisson.nixidy.mkConfiguration"; + + resolveEcosystemSrc = final.caisson.integrations.resolveEcosystemSrc { + name = "nixidy"; + context = "caisson.nixidy"; + }; + + # A nixidy source: the nixidy flake, which publishes `lib.mkEnv`. + assertNixidySrc = + ecosystemSrc: + if builtins.isAttrs ecosystemSrc && (ecosystemSrc.lib or { }) ? mkEnv then + ecosystemSrc + else + throw "${context} requires `ecosystemSrc` to be the nixidy flake (publishing lib.mkEnv)."; + + evaluate = + args: + { lib, manifest }: + let + selection = lib.caisson.integrations; + src = assertNixidySrc (resolveEcosystemSrc { + explicit = args.ecosystemSrc or null; + manifest = lib.caisson-core.libManifest or { }; + }); + + name = manifest.name or null; + inherit (manifest) system; + what = + if name != null then + "the nixidy configuration `${name}` at ${system}" + else + "this nixidy configuration at ${system}"; + + pkgSets = selection.pkgSetsAt { inherit context what; } manifest system; + pkgs = selection.pkgSetOf { inherit context what; } manifest pkgSets; + + registry = lib.caisson.modules.nixidy or { }; + frameworkModules = selection.frameworkModules "nixidy" registry; + moduleImports = selection.moduleImportsOf "nixidy" { inherit lib manifest; } args; + + # The configuration's module: the module passed, else the + # configuration registered under the configuration's name + # (`configs/nixidy/`), else none. + registered = lib.caisson.configs.nixidy or { }; + configModule = + if (args.configModule or null) != null then + args.configModule + else if name != null then + registered.${name} or null + else + null; + + value = src.lib.mkEnv ( + { + inherit pkgs lib; + modules = + frameworkModules + ++ moduleImports registry + ++ (if configModule == null then [ ] else [ configModule ]); + extraSpecialArgs = { + inherit pkgSets; + } + // (if (args.specialArgs or null) != null then args.specialArgs else { }); + # The namespaces of the composed library that nixidy's + # library does not have. + libOverlay = _self: super: builtins.removeAttrs lib (builtins.attrNames super); + } + // (if (args.ecosystemArgs or null) != null then args.ecosystemArgs else { }) + ); + in + { + inherit value; + outputs = { + inherit (value) environmentPackage activationPackage bootstrapPackage; + }; + inherit (value) config; + options = { }; + }; + + # A nixidy configuration is published as + # `nixidyEnvs..`, which the nixidy CLI reads. + exportsTo = { + attrset = "nixidyEnvs"; + bySystem = true; + value = manifest: manifest.value; + }; + + configuration = + args: + final.caisson.integrations.mkModuleConfiguration { + type = "nixidy"; + # A nixidy configuration is evaluated at a system: it has an + # evaluation for every system in force where it is declared. + perSystem = true; + defaultPkgs = args.defaultPkgs or null; + inherit exportsTo; + evaluate = evaluate args; + }; + + integration = final.caisson.integrations.mkIntegration { + name = "nixidy"; + class = "nixidy"; + # A nixidy configuration that is a top, as a tool reads it: the + # evaluation, or the evaluations by system where several are in + # force. + top = final.caisson.integrations.topValue; + # What these return is a configuration, a function of + # `{ name, parent }`: a parent that declares it under + # `caisson.nixidy.configurations.` finalizes it, and + # `mkTopConfiguration` finalizes it at a top. + mkConfiguration = + { + # The configuration's module. When absent, the configuration + # registered under the configuration's name + # (`lib.caisson.configs.nixidy.`), if any. Further + # modules of the class are selected with `moduleImports`, + # from the registry. + configModule ? null, + # The nixidy flake; resolved from the composition's + # declarations when absent. + ecosystemSrc ? null, + # The package set the configuration runs on: a function + # that receives the package sets available where it is + # declared, by package config name, each at the system of + # the evaluation, and returns the set to run on. When + # absent, the selection of the nearest configuration above, + # and the set named `default` where none above selects. + defaultPkgs ? null, + # The selection over the nixidy class of the registry. It + # replaces the default of the class, which is every entry + # named `default` followed by what the configurations + # above added. + moduleImports ? null, + # A selection added to that selection, whichever it is. + extraModuleImports ? null, + # Extra module arguments, merged over those the framework + # supplies; nixidy names these `extraSpecialArgs`. + specialArgs ? null, + }@args: + configuration args; + # The same arguments and `ecosystemArgs`, the evaluator's + # arguments merged over the composed call last. + mkConfigurationWithEcosystemArgs = + { + configModule ? null, + ecosystemSrc ? null, + defaultPkgs ? null, + moduleImports ? null, + extraModuleImports ? null, + specialArgs ? null, + ecosystemArgs ? null, + }@args: + configuration args; + }; + in + { + caisson = (prev.caisson or { }) // { + nixidy = integration.namespace; + }; + }; + +} diff --git a/lib-overlays/topology/default.nix b/lib-overlays/topology/default.nix new file mode 100644 index 00000000..f9ab49cd --- /dev/null +++ b/lib-overlays/topology/default.nix @@ -0,0 +1,238 @@ +# SPDX-License-Identifier: MIT +# +# The topology integration: it owns the `topology` class, the class of +# nix-topology's modules. A topology configuration is the diagram of a +# network of machines: the NixOS configurations declared inside it, +# whose `topology` options nix-topology reads, and the modules of the +# class, which add nodes and networks of their own. It is evaluated at +# every system in force where it is declared, on the package set +# selected for it. +# +# nix-topology evaluates its modules with `evalModules` over its +# `topology` directory, given the NixOS configurations to read as the +# option `nixosConfigurations`. caisson makes that evaluation on the +# composed library, on the selected package set extended with the +# package overlay of nix-topology, and sets `nixosConfigurations` to +# the NixOS configurations declared inside the topology configuration, +# evaluated at its system. Those NixOS configurations get the NixOS +# module of nix-topology by default, through `caisson.forChildren`. +# +# The output is `output`, the rendered diagram. The configuration +# declared under the name `default` is published as `topology.`, +# the evaluation, where nix-topology's flake module publishes it, so +# `nix build .#topology..config.output` builds the diagram. +{ + mkLibOverlay, + ... +}: +{ + + imports = [ + # The library of nixpkgs, which this overlay calls through the + # composed library, imported by key so it is composed wherever + # this is. + ((mkLibOverlay ../nixpkgs-lib) // { key = "nixpkgs-lib"; }) + # What an integration is written from, imported by key so it is + # composed wherever this integration is. + ((mkLibOverlay ../integrations) // { key = "integrations"; }) + ]; + + overlay = + final: prev: + let + context = "lib.caisson.topology.mkConfiguration"; + + resolveEcosystemSrc = final.caisson.integrations.resolveEcosystemSrc { + name = "nix-topology"; + context = "caisson.topology"; + }; + + # A nix-topology source: the nix-topology flake or source tree, + # which holds the topology modules, its NixOS module and its + # package overlay. + assertTopologySrc = + ecosystemSrc: + let + path = if builtins.isAttrs ecosystemSrc then ecosystemSrc.outPath or null else ecosystemSrc; + in + if + path != null + && builtins.pathExists "${path}/topology/default.nix" + && builtins.pathExists "${path}/nixos/module.nix" + && builtins.pathExists "${path}/pkgs/default.nix" + then + ecosystemSrc + else + throw "${context} requires `ecosystemSrc` to be a nix-topology flake or source tree (holding topology, nixos/module.nix and pkgs/default.nix)."; + + evaluate = + args: + { lib, manifest }: + let + selection = lib.caisson.integrations; + src = assertTopologySrc (resolveEcosystemSrc { + explicit = args.ecosystemSrc or null; + manifest = lib.caisson-core.libManifest or { }; + }); + + name = manifest.name or null; + inherit (manifest) system; + what = + if name != null then + "the topology configuration `${name}` at ${system}" + else + "this topology configuration at ${system}"; + + pkgSets = selection.pkgSetsAt { inherit context what; } manifest system; + pkgs = (selection.pkgSetOf { inherit context what; } manifest pkgSets).extend ( + import "${src}/pkgs/default.nix" + ); + + registry = lib.caisson.modules.topology or { }; + frameworkModules = selection.frameworkModules "topology" registry; + moduleImports = selection.moduleImportsOf "topology" { inherit lib manifest; } args; + + # The configuration's module: the module passed, else the + # configuration registered under the configuration's name + # (`configs/topology/`), else none. + registered = lib.caisson.configs.topology or { }; + configModule = + if (args.configModule or null) != null then + args.configModule + else if name != null then + registered.${name} or null + else + null; + + # The NixOS configurations declared inside, at this system, as + # the configurations nix-topology reads. They are read in the + # full evaluation; the childless evaluation reads none. + machinesModule = + { config, lib, ... }: + { + _file = "caisson-topology:machines"; + nixosConfigurations = + if lib.caisson-core.evalManifest.childless then + { } + else + builtins.mapAttrs (_: evaluations: evaluations.${system}.value) ( + lib.filterAttrs (_: evaluations: evaluations ? ${system}) config.caisson.nixos.configurations + ); + # The NixOS configurations declared inside get the NixOS + # module of nix-topology, which declares the options + # nix-topology reads. + caisson.forChildren.extraDefaultModuleImports.nixos = _lib: [ "${src}/nixos/module.nix" ]; + }; + + value = lib.evalModules ( + { + class = "topology"; + prefix = [ "topology" ]; + specialArgs = { + inherit lib pkgs pkgSets; + modulesPath = toString "${src}/topology"; + } + // (if (args.specialArgs or null) != null then args.specialArgs else { }); + modules = [ + "${src}/topology" + machinesModule + ] + ++ frameworkModules + ++ moduleImports registry + ++ (if configModule == null then [ ] else [ configModule ]); + } + // (if (args.ecosystemArgs or null) != null then args.ecosystemArgs else { }) + ); + in + { + inherit value; + outputs.output = value.config.output; + }; + + # The configuration named `default` is published as + # `topology.`, the evaluation. + exportsTo = { + attrset = "topology"; + single = true; + bySystem = true; + value = manifest: manifest.value; + }; + + configuration = + args: + final.caisson.integrations.mkModuleConfiguration { + type = "topology"; + # A topology configuration is evaluated at a system: it has an + # evaluation for every system in force where it is declared. + perSystem = true; + defaultPkgs = args.defaultPkgs or null; + inherit exportsTo; + evaluate = evaluate args; + }; + + integration = final.caisson.integrations.mkIntegration { + name = "topology"; + class = "topology"; + # A topology configuration that is a top, as a tool reads it: + # the evaluation, or the evaluations by system where several + # are in force. + top = final.caisson.integrations.topValue; + # What these return is a configuration, a function of + # `{ name, parent }`: a parent that declares it under + # `caisson.topology.configurations.` finalizes it, and + # `mkTopConfiguration` finalizes it at a top. + mkConfiguration = + { + # The configuration's module: the nodes and networks of the + # diagram, and the NixOS configurations it reads under + # `caisson.nixos.configurations`. When absent, the + # configuration registered under the configuration's name + # (`lib.caisson.configs.topology.`), if any. Further + # modules of the class are selected with `moduleImports`, + # from the registry. + configModule ? null, + # The nix-topology flake or source tree; resolved from the + # composition's declarations under the name `nix-topology` + # when absent. + ecosystemSrc ? null, + # The package set the configuration runs on: a function + # that receives the package sets available where it is + # declared, by package config name, each at the system of + # the evaluation, and returns the set to run on. When + # absent, the selection of the nearest configuration above, + # and the set named `default` where none above selects. + defaultPkgs ? null, + # The selection over the topology class of the registry. It + # replaces the default of the class, which is every entry + # named `default` followed by what the configurations + # above added. + moduleImports ? null, + # A selection added to that selection, whichever it is. + extraModuleImports ? null, + # Extra module arguments, merged over those the framework + # supplies. + specialArgs ? null, + }@args: + configuration args; + # The same arguments and `ecosystemArgs`, the evaluator's + # arguments merged over the composed call last. + mkConfigurationWithEcosystemArgs = + { + configModule ? null, + ecosystemSrc ? null, + defaultPkgs ? null, + moduleImports ? null, + extraModuleImports ? null, + specialArgs ? null, + ecosystemArgs ? null, + }@args: + configuration args; + }; + in + { + caisson = (prev.caisson or { }) // { + topology = integration.namespace; + }; + }; + +} diff --git a/modules/generic/core/default.nix b/modules/generic/core/default.nix index f7fcb3b5..cfc89466 100644 --- a/modules/generic/core/default.nix +++ b/modules/generic/core/default.nix @@ -38,6 +38,8 @@ "flake-parts" "hjem" "home-manager" + "kubenix" + "nixidy" "nixos" "nixpkgs" "nixvim" @@ -45,6 +47,7 @@ "structural" "system-manager" "terranix" + "topology" "treefmt" ]) ] diff --git a/modules/kubenix/core b/modules/kubenix/core new file mode 120000 index 00000000..3715354a --- /dev/null +++ b/modules/kubenix/core @@ -0,0 +1 @@ +../generic/core \ No newline at end of file diff --git a/modules/nixidy/core b/modules/nixidy/core new file mode 120000 index 00000000..3715354a --- /dev/null +++ b/modules/nixidy/core @@ -0,0 +1 @@ +../generic/core \ No newline at end of file diff --git a/modules/topology/core b/modules/topology/core new file mode 120000 index 00000000..3715354a --- /dev/null +++ b/modules/topology/core @@ -0,0 +1 @@ +../generic/core \ No newline at end of file diff --git a/tests/argument-errors/check.sh b/tests/argument-errors/check.sh index b48b4e2e..cf81e8ae 100755 --- a/tests/argument-errors/check.sh +++ b/tests/argument-errors/check.sh @@ -43,6 +43,9 @@ namespaces=( treefmt nvf nixvim + topology + kubenix + nixidy ) failures=0 diff --git a/tests/dependencies/flake.lock b/tests/dependencies/flake.lock index 6d517bb1..89d88bfe 100644 --- a/tests/dependencies/flake.lock +++ b/tests/dependencies/flake.lock @@ -39,6 +39,27 @@ "type": "github" } }, + "devshell": { + "inputs": { + "nixpkgs": [ + "kubenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1768818222, + "narHash": "sha256-460jc0+CZfyaO8+w8JNtlClB2n4ui1RbHfPTLkpwhU8=", + "owner": "numtide", + "repo": "devshell", + "rev": "255a2b1725a20d060f566e4755dbf571bbbb5f76", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, "disko": { "inputs": { "nixpkgs": [ @@ -76,6 +97,22 @@ } }, "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1767039857, + "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_3": { "flake": false, "locked": { "lastModified": 1777699697, @@ -91,7 +128,7 @@ "url": "https://git.lix.systems/lix-project/flake-compat.git" } }, - "flake-compat_3": { + "flake-compat_4": { "flake": false, "locked": { "lastModified": 1767039857, @@ -128,6 +165,42 @@ } }, "flake-parts_2": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1785627969, + "narHash": "sha256-4dtXQk/NMePegK/nWp5NSeuZKLATItOq61lpEvmXqGw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "427bf4bd9435fdf21321c8cc628c24efc14c0f7a", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_3": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_2" + }, + "locked": { + "lastModified": 1772408722, + "narHash": "sha256-rHuJtdcOjK7rAHpHphUb1iCvgkU3GpfvicLMwwnfMT0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f20dc5d9b8027381c474144ecabc9034d6a839a3", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_4": { "inputs": { "nixpkgs-lib": [ "nixvim", @@ -148,7 +221,7 @@ "type": "github" } }, - "flake-parts_3": { + "flake-parts_5": { "inputs": { "nixpkgs-lib": [ "system-manager", @@ -170,7 +243,7 @@ "type": "github" } }, - "flake-parts_4": { + "flake-parts_6": { "inputs": { "nixpkgs-lib": [ "terranix", @@ -209,6 +282,24 @@ "type": "github" } }, + "flake-utils_2": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "gitignore": { "inputs": { "nixpkgs": [ @@ -287,6 +378,47 @@ "type": "github" } }, + "import-tree_2": { + "locked": { + "lastModified": 1784254960, + "narHash": "sha256-iI88R3wHz8wTKQb5orvpc51L/Xr64AJyxid/0MKa/b8=", + "owner": "vic", + "repo": "import-tree", + "rev": "4ebb10ae17d5f1ad366e7aef5b92cb8eecf24f69", + "type": "github" + }, + "original": { + "owner": "vic", + "repo": "import-tree", + "type": "github" + } + }, + "kubenix": { + "inputs": { + "devshell": "devshell", + "flake-compat": "flake-compat_2", + "flake-parts": "flake-parts_2", + "import-tree": "import-tree", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems_2", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1787550939, + "narHash": "sha256-BlFIpyBO7uYiw1Ra/uPLS93I4wUK1A6oAPmG2CxCwVE=", + "owner": "hall", + "repo": "kubenix", + "rev": "6a37ce99125b068a7da9eb7bebd29898ed043eb5", + "type": "github" + }, + "original": { + "owner": "hall", + "repo": "kubenix", + "type": "github" + } + }, "mnw": { "locked": { "lastModified": 1784154424, @@ -364,13 +496,49 @@ "type": "github" } }, + "nix-kube-generators": { + "locked": { + "lastModified": 1748274972, + "narHash": "sha256-Z8Bh7Y9Rr8PPspfb5M1nNW+zdwdyt43htN1lDqiH09M=", + "owner": "farcaller", + "repo": "nix-kube-generators", + "rev": "eeeaeacd7b7a2618baf08b8458f3dc4766752df8", + "type": "github" + }, + "original": { + "owner": "farcaller", + "repo": "nix-kube-generators", + "type": "github" + } + }, + "nix-topology": { + "inputs": { + "flake-parts": "flake-parts_3", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1782153600, + "narHash": "sha256-Vbkgl7/x8+Gg0gMe94EStfIfNC4bHQIbaZrIAxpuQ/w=", + "owner": "oddlama", + "repo": "nix-topology", + "rev": "e61876f548e4f301d63640d30ecc1305c05c3986", + "type": "github" + }, + "original": { + "owner": "oddlama", + "repo": "nix-topology", + "type": "github" + } + }, "nix-unit": { "inputs": { "nix-github-actions": "nix-github-actions_2", "nixpkgs": [ "nixpkgs" ], - "treefmt-nix": "treefmt-nix" + "treefmt-nix": "treefmt-nix_2" }, "locked": { "lastModified": 1779338171, @@ -386,6 +554,28 @@ "type": "github" } }, + "nixidy": { + "inputs": { + "flake-utils": "flake-utils_2", + "nix-kube-generators": "nix-kube-generators", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1792062694, + "narHash": "sha256-uEacRc07s+nJl2ZQ1VejSl9fgdpureM+4uZQJF26uZk=", + "owner": "arnarg", + "repo": "nixidy", + "rev": "9a2521f7ae2b56b87070de09a5b78ab14b440220", + "type": "github" + }, + "original": { + "owner": "arnarg", + "repo": "nixidy", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1789785513, @@ -403,6 +593,36 @@ } }, "nixpkgs-lib": { + "locked": { + "lastModified": 1785031560, + "narHash": "sha256-OmshNvn2vupOFpYinLUu+1Dnpu4n7Q5N3ggGVNHpkUI=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "0e79af5e3d4dcfcd676ab5ba3f95d2e3352e078c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs-lib_2": { + "locked": { + "lastModified": 1772328832, + "narHash": "sha256-e+/T/pmEkLP6BHhYjx6GmwP5ivonQQn0bJdH9YrRB+Q=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "c185c7a5e5dd8f9add5b2f8ebeff00888b070742", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs-lib_3": { "locked": { "lastModified": 1789266065, "narHash": "sha256-XtTdVeJX6X/gU+vGIUEJHirotv/lYP5+Q9irMH6HWPY=", @@ -419,11 +639,11 @@ }, "nixvim": { "inputs": { - "flake-parts": "flake-parts_2", + "flake-parts": "flake-parts_4", "nixpkgs": [ "nixpkgs" ], - "systems": "systems_2" + "systems": "systems_4" }, "locked": { "lastModified": 1792203519, @@ -441,7 +661,7 @@ }, "nvf": { "inputs": { - "flake-compat": "flake-compat_2", + "flake-compat": "flake-compat_3", "mnw": "mnw", "nixpkgs": [ "nixpkgs" @@ -497,15 +717,18 @@ "flake-parts": "flake-parts", "hjem": "hjem", "home-manager": "home-manager", + "kubenix": "kubenix", "nix-darwin": "nix-darwin", + "nix-topology": "nix-topology", "nix-unit": "nix-unit", + "nixidy": "nixidy", "nixpkgs": "nixpkgs", - "nixpkgs-lib": "nixpkgs-lib", + "nixpkgs-lib": "nixpkgs-lib_3", "nixvim": "nixvim", "nvf": "nvf", "system-manager": "system-manager", "terranix": "terranix", - "treefmt-nix": "treefmt-nix_2" + "treefmt-nix": "treefmt-nix_3" } }, "stable": { @@ -526,7 +749,7 @@ }, "system-manager": { "inputs": { - "flake-compat": "flake-compat_3", + "flake-compat": "flake-compat_4", "nixpkgs": [ "nixpkgs" ], @@ -562,6 +785,36 @@ } }, "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_4": { "flake": false, "locked": { "lastModified": 1791244623, @@ -578,7 +831,7 @@ "type": "github" } }, - "systems_3": { + "systems_5": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -593,7 +846,7 @@ "type": "github" } }, - "systems_4": { + "systems_6": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -610,12 +863,12 @@ }, "terranix": { "inputs": { - "flake-parts": "flake-parts_4", - "import-tree": "import-tree", + "flake-parts": "flake-parts_6", + "import-tree": "import-tree_2", "nixpkgs": [ "nixpkgs" ], - "systems": "systems_4" + "systems": "systems_6" }, "locked": { "lastModified": 1784465933, @@ -632,6 +885,27 @@ } }, "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "kubenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1786901030, + "narHash": "sha256-WSFCsDSE5ffgD2MqzkM2CYjeFiKhRF/dJUN8uedb6YE=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "27b3b12a8e6375f28ebe122f07d230ca5459bbfa", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "treefmt-nix_2": { "inputs": { "nixpkgs": [ "nix-unit", @@ -652,7 +926,7 @@ "type": "github" } }, - "treefmt-nix_2": { + "treefmt-nix_3": { "inputs": { "nixpkgs": [ "nixpkgs" @@ -678,13 +952,13 @@ "system-manager", "flake-compat" ], - "flake-parts": "flake-parts_3", + "flake-parts": "flake-parts_5", "nixpkgs": [ "system-manager", "nixpkgs" ], "pre-commit-hooks-nix": "pre-commit-hooks-nix", - "systems": "systems_3" + "systems": "systems_5" }, "locked": { "lastModified": 1770377964, diff --git a/tests/dependencies/flake.nix b/tests/dependencies/flake.nix index 459b35dc..8ee43b2c 100644 --- a/tests/dependencies/flake.nix +++ b/tests/dependencies/flake.nix @@ -21,6 +21,12 @@ inputs.system-manager.inputs.nixpkgs.follows = "nixpkgs"; inputs.disko.url = "github:nix-community/disko"; inputs.disko.inputs.nixpkgs.follows = "nixpkgs"; + inputs.nix-topology.url = "github:oddlama/nix-topology"; + inputs.nix-topology.inputs.nixpkgs.follows = "nixpkgs"; + inputs.kubenix.url = "github:hall/kubenix"; + inputs.kubenix.inputs.nixpkgs.follows = "nixpkgs"; + inputs.nixidy.url = "github:arnarg/nixidy"; + inputs.nixidy.inputs.nixpkgs.follows = "nixpkgs"; inputs.nixvim.url = "github:nix-community/nixvim"; inputs.nixvim.inputs.nixpkgs.follows = "nixpkgs"; inputs.nvf.url = "github:NotAShelf/nvf"; diff --git a/tests/pinned-world/default.nix b/tests/pinned-world/default.nix index c7e4449d..77f8a94c 100644 --- a/tests/pinned-world/default.nix +++ b/tests/pinned-world/default.nix @@ -74,6 +74,9 @@ let registered."caisson/treefmt" registered."caisson/nvf" registered."caisson/nixvim" + registered."caisson/topology" + registered."caisson/kubenix" + registered."caisson/nixidy" registered."caisson/structural" # Last, so its value replaces the pin the overlays carry while # its position stays where the first import placed it. @@ -105,6 +108,7 @@ let "home-manager" "importApply" "integrations" + "kubenix" "libManifest" "libOverlays" "manifestOf" @@ -117,6 +121,7 @@ let "mkPkgOverlay" "mkPkgOverlays" "modules" + "nixidy" "nixos" "nixos-minimal" "nixpkgs" @@ -130,6 +135,7 @@ let "structural" "system-manager" "terranix" + "topology" "treefmt" ]; @@ -489,6 +495,9 @@ let "caisson/treefmt" "caisson/nvf" "caisson/nixvim" + "caisson/topology" + "caisson/kubenix" + "caisson/nixidy" "caisson/structural" ]; @@ -591,6 +600,9 @@ let "treefmt" "nvf" "nixvim" + "topology" + "kubenix" + "nixidy" ]; minimalNixosSystemEvaluates = @@ -1812,6 +1824,130 @@ let top.nixvimConfigurations.x86_64-linux.editor.config.build.package.drvPath == upstream.config.build.package.drvPath; + # A topology configuration with two machines declared inside it reads + # them as nix-topology reads NixOS configurations evaluated with its + # NixOS module: the same nodes, and the same rendered diagram. It is + # published as `topology.` under the name `default`, and its + # machines as `nixosConfigurations`. + topologyReadsTheMachinesDeclaredInside = + let + machine = { + boot.loader.grub.enable = false; + fileSystems."/" = { + device = "none"; + fsType = "tmpfs"; + }; + system.stateVersion = "25.05"; + }; + top = hiveLib.caisson.structural.mkTopConfiguration { + moduleImports = _modules: [ ]; + configModule = + { lib, ... }: + { + caisson.topology.configurations.default = lib.caisson.topology.mkConfiguration { + ecosystemSrc = inputs.nix-topology; + configModule = + { lib, ... }: + { + caisson.nixos.configurations.alpha = lib.caisson.nixos.mkConfiguration { + configModule = machine; + }; + caisson.nixos.configurations.beta = lib.caisson.nixos.mkConfiguration { + configModule = machine; + }; + }; + }; + }; + }; + upstreamMachine = + hostName: + import "${inputs.nixpkgs}/nixos/lib/eval-config.nix" { + system = "x86_64-linux"; + modules = [ + machine + "${inputs.nix-topology}/nixos/module.nix" + { networking.hostName = hostName; } + ]; + }; + upstream = import inputs.nix-topology { + pkgs = pkgs.extend (import "${inputs.nix-topology}/pkgs/default.nix"); + modules = [ + { + nixosConfigurations = { + alpha = upstreamMachine "alpha"; + beta = upstreamMachine "beta"; + }; + } + ]; + }; + topology = top.topology.x86_64-linux; + in + builtins.attrNames top.nixosConfigurations == [ + "alpha" + "beta" + ] + && builtins.attrNames topology.config.nodes == builtins.attrNames upstream.config.nodes + && builtins.elem "alpha" (builtins.attrNames topology.config.nodes) + && topology.config.output.drvPath == upstream.config.output.drvPath; + + # A kubenix configuration is published as `packages..`, + # its result, which is the result kubenix's own `evalModules` gives + # the same module on the same package set. + kubenixIsTheResultKubenixBuilds = + let + module = + { kubenix, ... }: + { + imports = [ kubenix.modules.k8s ]; + kubernetes.resources.configMaps.demo.data.greeting = "hello"; + }; + top = hiveLib.caisson.structural.mkTopConfiguration { + moduleImports = _modules: [ ]; + configModule = + { lib, ... }: + { + caisson.kubenix.configurations.cluster = lib.caisson.kubenix.mkConfiguration { + ecosystemSrc = inputs.kubenix; + configModule = module; + }; + }; + }; + upstream = import "${inputs.kubenix}/lib/eval-modules.nix" { inherit pkgs; } { inherit module; }; + in + top.packages.x86_64-linux.cluster.drvPath == upstream.config.kubernetes.result.drvPath; + + # A nixidy configuration is published as + # `nixidyEnvs..`, and its rendered environment is the + # one nixidy's own `mkEnv` renders from the same module on the same + # package set. + nixidyIsTheEnvironmentNixidyRenders = + let + module = { + nixidy.target.repository = "https://example.com/manifests.git"; + nixidy.target.branch = "main"; + applications.demo = { + namespace = "demo"; + resources.configMaps.demo.data.greeting = "hello"; + }; + }; + top = hiveLib.caisson.structural.mkTopConfiguration { + moduleImports = _modules: [ ]; + configModule = + { lib, ... }: + { + caisson.nixidy.configurations.prod = lib.caisson.nixidy.mkConfiguration { + ecosystemSrc = inputs.nixidy; + configModule = module; + }; + }; + }; + upstream = inputs.nixidy.lib.mkEnv { + inherit pkgs; + modules = [ module ]; + }; + in + top.nixidyEnvs.x86_64-linux.prod.environmentPackage.drvPath == upstream.environmentPackage.drvPath; + # A terranix configuration that is a top is its `config.tf.json` # file, built from the package set of the composition with the # evaluated configuration in its `passthru`, and its modules get the diff --git a/tests/unit/lib-overlays.nix b/tests/unit/lib-overlays.nix index 8b618afd..e34bb3a5 100644 --- a/tests/unit/lib-overlays.nix +++ b/tests/unit/lib-overlays.nix @@ -129,6 +129,9 @@ let "treefmt" "nvf" "nixvim" + "topology" + "kubenix" + "nixidy" ]; in @@ -5395,6 +5398,9 @@ in "treefmt" "nvf" "nixvim" + "topology" + "kubenix" + "nixidy" ]; setsFromTheComposition = builtins.elem name [ "nixos" @@ -5410,6 +5416,9 @@ in "treefmt" "nvf" "nixvim" + "topology" + "kubenix" + "nixidy" ]; in signature ? configModule From 9d5115c2e340292d0953dd247a11876aa16e19ff Mon Sep 17 00:00:00 2001 From: Chris Hodapp Date: Sat, 17 Oct 2026 10:06:39 -0700 Subject: [PATCH 3/5] maint: say a configuration is evaluated per system A configuration with `perSystem` has an evaluation for each system in force; the comments called it "evaluated at a system", which names one of those evaluations. Co-Authored-By: Claude Opus 5.5 --- lib-overlays/darwin/default.nix | 2 +- lib-overlays/hjem/default.nix | 2 +- lib-overlays/home-manager/default.nix | 2 +- lib-overlays/integrations/default.nix | 6 +++--- lib-overlays/kubenix/default.nix | 2 +- lib-overlays/nixidy/default.nix | 2 +- lib-overlays/nixos/default.nix | 2 +- lib-overlays/nixvim/default.nix | 2 +- lib-overlays/nvf/default.nix | 2 +- lib-overlays/system-manager/default.nix | 2 +- lib-overlays/terranix/default.nix | 2 +- lib-overlays/topology/default.nix | 2 +- lib-overlays/treefmt/default.nix | 2 +- modules/generic/core/caisson/configurations.nix | 2 +- tests/hjem-system/default.nix | 4 ++-- tests/unit/lib-overlays.nix | 2 +- 16 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lib-overlays/darwin/default.nix b/lib-overlays/darwin/default.nix index 7723be7b..1b3c605a 100644 --- a/lib-overlays/darwin/default.nix +++ b/lib-overlays/darwin/default.nix @@ -159,7 +159,7 @@ args: final.caisson.integrations.mkModuleConfiguration { type = "darwin"; - # A darwin configuration is evaluated at a system: it has an + # A darwin configuration is evaluated per system: it has an # evaluation for every system in force where it is declared. perSystem = true; defaultPkgs = args.defaultPkgs or null; diff --git a/lib-overlays/hjem/default.nix b/lib-overlays/hjem/default.nix index 4e0cff25..c2dcf188 100644 --- a/lib-overlays/hjem/default.nix +++ b/lib-overlays/hjem/default.nix @@ -273,7 +273,7 @@ args: final.caisson.integrations.mkModuleConfiguration { type = "hjem"; - # A hjem configuration is evaluated at a system: it has an + # A hjem configuration is evaluated per system: it has an # evaluation for every system in force where it is declared. perSystem = true; defaultPkgs = args.defaultPkgs or null; diff --git a/lib-overlays/home-manager/default.nix b/lib-overlays/home-manager/default.nix index ee5f8191..9674b65b 100644 --- a/lib-overlays/home-manager/default.nix +++ b/lib-overlays/home-manager/default.nix @@ -509,7 +509,7 @@ variant: args: selection.mkModuleConfiguration { type = "home-manager"; - # A home is evaluated at a system: it has an evaluation for + # A home is evaluated per system: it has an evaluation for # every system in force where it is declared. perSystem = true; defaultPkgs = args.defaultPkgs or null; diff --git a/lib-overlays/integrations/default.nix b/lib-overlays/integrations/default.nix index 88bf9d97..6c8e20c3 100644 --- a/lib-overlays/integrations/default.nix +++ b/lib-overlays/integrations/default.nix @@ -226,7 +226,7 @@ # A configuration that is a module evaluation. `type` is the # name of the integration and `perSystem` whether it evaluates a - # configuration at a system, as caisson-core.mkConfiguration + # configuration per system, as caisson-core.mkConfiguration # takes them. `evaluate` is the evaluator step of the # integration: it takes the view being evaluated, `{ lib, # manifest }`, and returns `value`, the evaluation as the @@ -467,7 +467,7 @@ } child; # The integration of what was declared: of the # manifest, or of the evaluations of a configuration - # evaluated at a system, null where it has none. + # evaluated per system, null where it has none. declaredType = if isManifest finalized then finalized.type @@ -822,7 +822,7 @@ genAttrs attrsets publishIn; # What a tool reads from a top that is a configuration evaluated - # at a system, given its evaluations by system. They are named + # per system, given its evaluations by system. They are named # like anything published, by `caisson-core.elide` over their # paths; the top is addressed by the file that returns it, so the # name of the top is left out of each. Where that leaves a single diff --git a/lib-overlays/kubenix/default.nix b/lib-overlays/kubenix/default.nix index 530e8368..238432ea 100644 --- a/lib-overlays/kubenix/default.nix +++ b/lib-overlays/kubenix/default.nix @@ -166,7 +166,7 @@ args: final.caisson.integrations.mkModuleConfiguration { type = "kubenix"; - # A kubenix configuration is evaluated at a system: it has an + # A kubenix configuration is evaluated per system: it has an # evaluation for every system in force where it is declared. perSystem = true; defaultPkgs = args.defaultPkgs or null; diff --git a/lib-overlays/nixidy/default.nix b/lib-overlays/nixidy/default.nix index 1f31b393..82e9692d 100644 --- a/lib-overlays/nixidy/default.nix +++ b/lib-overlays/nixidy/default.nix @@ -129,7 +129,7 @@ args: final.caisson.integrations.mkModuleConfiguration { type = "nixidy"; - # A nixidy configuration is evaluated at a system: it has an + # A nixidy configuration is evaluated per system: it has an # evaluation for every system in force where it is declared. perSystem = true; defaultPkgs = args.defaultPkgs or null; diff --git a/lib-overlays/nixos/default.nix b/lib-overlays/nixos/default.nix index 52c8521a..037b5fcd 100644 --- a/lib-overlays/nixos/default.nix +++ b/lib-overlays/nixos/default.nix @@ -109,7 +109,7 @@ variant: args: final.caisson.integrations.mkModuleConfiguration { type = "nixos"; - # A NixOS configuration is evaluated at a system: it has an + # A NixOS configuration is evaluated per system: it has an # evaluation for every system in force where it is declared. perSystem = true; defaultPkgs = args.defaultPkgs or null; diff --git a/lib-overlays/nixvim/default.nix b/lib-overlays/nixvim/default.nix index 14bc71a0..cb955d8a 100644 --- a/lib-overlays/nixvim/default.nix +++ b/lib-overlays/nixvim/default.nix @@ -151,7 +151,7 @@ args: final.caisson.integrations.mkModuleConfiguration { type = "nixvim"; - # A nixvim configuration is evaluated at a system: it has an + # A nixvim configuration is evaluated per system: it has an # evaluation for every system in force where it is declared. perSystem = true; defaultPkgs = args.defaultPkgs or null; diff --git a/lib-overlays/nvf/default.nix b/lib-overlays/nvf/default.nix index b9d4816c..83d924fa 100644 --- a/lib-overlays/nvf/default.nix +++ b/lib-overlays/nvf/default.nix @@ -163,7 +163,7 @@ args: final.caisson.integrations.mkModuleConfiguration { type = "nvf"; - # An nvf configuration is evaluated at a system: it has an + # An nvf configuration is evaluated per system: it has an # evaluation for every system in force where it is declared. perSystem = true; defaultPkgs = args.defaultPkgs or null; diff --git a/lib-overlays/system-manager/default.nix b/lib-overlays/system-manager/default.nix index 7282ebc4..493ad60a 100644 --- a/lib-overlays/system-manager/default.nix +++ b/lib-overlays/system-manager/default.nix @@ -293,7 +293,7 @@ args: final.caisson.integrations.mkModuleConfiguration { type = "system-manager"; - # A system-manager configuration is evaluated at a system: it + # A system-manager configuration is evaluated per system: it # has an evaluation for every system in force where it is # declared. perSystem = true; diff --git a/lib-overlays/terranix/default.nix b/lib-overlays/terranix/default.nix index 6c9701aa..7939c1fe 100644 --- a/lib-overlays/terranix/default.nix +++ b/lib-overlays/terranix/default.nix @@ -145,7 +145,7 @@ args: final.caisson.integrations.mkModuleConfiguration { type = "terranix"; - # A terranix configuration is evaluated at a system: it has an + # A terranix configuration is evaluated per system: it has an # evaluation for every system in force where it is declared. perSystem = true; defaultPkgs = args.defaultPkgs or null; diff --git a/lib-overlays/topology/default.nix b/lib-overlays/topology/default.nix index f9ab49cd..ee522004 100644 --- a/lib-overlays/topology/default.nix +++ b/lib-overlays/topology/default.nix @@ -162,7 +162,7 @@ args: final.caisson.integrations.mkModuleConfiguration { type = "topology"; - # A topology configuration is evaluated at a system: it has an + # A topology configuration is evaluated per system: it has an # evaluation for every system in force where it is declared. perSystem = true; defaultPkgs = args.defaultPkgs or null; diff --git a/lib-overlays/treefmt/default.nix b/lib-overlays/treefmt/default.nix index 72158e36..74440405 100644 --- a/lib-overlays/treefmt/default.nix +++ b/lib-overlays/treefmt/default.nix @@ -169,7 +169,7 @@ args: final.caisson.integrations.mkModuleConfiguration { type = "treefmt"; - # A treefmt configuration is evaluated at a system: it has an + # A treefmt configuration is evaluated per system: it has an # evaluation for every system in force where it is declared. perSystem = true; defaultPkgs = args.defaultPkgs or null; diff --git a/modules/generic/core/caisson/configurations.nix b/modules/generic/core/caisson/configurations.nix index 06b02d47..ade157f6 100644 --- a/modules/generic/core/caisson/configurations.nix +++ b/modules/generic/core/caisson/configurations.nix @@ -37,7 +37,7 @@ let integration: config.caisson.${integration}.exported config.caisson.${integration}.configurations ); - # The manifests passed up: a configuration evaluated at a system + # The manifests passed up: a configuration evaluated per system # stands for each of its evaluations. exported = builtins.concatMap ( integration: diff --git a/tests/hjem-system/default.nix b/tests/hjem-system/default.nix index 7b987192..7eabd6cb 100644 --- a/tests/hjem-system/default.nix +++ b/tests/hjem-system/default.nix @@ -113,8 +113,8 @@ in user ; # The machine and the hjem configuration `probe` inside it, as their - # manifests. A configuration evaluated at a system sits under that - # system in the manifest of its parent. + # manifests. Each evaluation of a configuration evaluated per system + # sits under its system in the manifest of its parent. machineManifest = top.caisson.manifest.children.system.${system}.children.nixos.probe-machine; inner = top.caisson.manifest.children.system.${system}.children.nixos.probe-machine.children.system.${system}.children.hjem.probe; diff --git a/tests/unit/lib-overlays.nix b/tests/unit/lib-overlays.nix index e34bb3a5..bb595812 100644 --- a/tests/unit/lib-overlays.nix +++ b/tests/unit/lib-overlays.nix @@ -5367,7 +5367,7 @@ in # The entry points whose constructor returns a configuration take # `configModule` as optional: each finds the configuration # registered under the name of the configuration. The entry points - # of the configurations evaluated at a system take no `pkgSets`: + # of the configurations evaluated per system take no `pkgSets`: # those configurations take their package sets from the # composition. The structural, colmena, disko and flake-parts # entry points take `pkgSets` and hand it to their modules. From aa8a95c37ab548271e8e10bf72707c7e7d0244de Mon Sep 17 00:00:00 2001 From: Chris Hodapp Date: Sun, 18 Oct 2026 00:43:56 -0700 Subject: [PATCH 4/5] fix(kubenix): publish a configuration as kubenixConfigurations A configuration is published as `kubenixConfigurations..`, the evaluation kubenix's `evalModules` returns, whose `config.kubernetes.result` is the JSON `kubectl apply -f` reads. Co-Authored-By: Claude Opus 5.5 --- README.md | 2 +- lib-overlays/kubenix/default.nix | 11 +++++++---- tests/pinned-world/default.nix | 10 ++++++---- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 42f4f7fa..8baee178 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ source by. | `nvf` | `nvf` | a Neovim written as nvf modules, published as `nvfConfigurations..`, in the shape `neovimConfiguration` returns | | `nixvim` | `nixvim` | a Neovim written as nixvim modules, published as `nixvimConfigurations..` | | `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.` | -| `kubenix` | `kubenix` | Kubernetes resources written as kubenix modules, published as `packages..`, the JSON `kubectl apply -f` reads | +| `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 | | `structural` | none | a configuration that only exports and holds configurations beneath it: the top of a repository whose point is what it exports, such as caisson itself, or a layer at any depth | diff --git a/lib-overlays/kubenix/default.nix b/lib-overlays/kubenix/default.nix index 238432ea..56ec2989 100644 --- a/lib-overlays/kubenix/default.nix +++ b/lib-overlays/kubenix/default.nix @@ -16,7 +16,8 @@ # The output is `result`, the resources as a JSON file, which # `kubectl apply -f` reads; it is the `kubernetes.result` of kubenix's # `k8s` module, so a configuration that imports that module has it. A -# configuration is published as `packages..`, its result. +# configuration is published as `kubenixConfigurations..`, +# the evaluation, whose `config.kubernetes.result` is the result. { mkLibOverlay, ... @@ -155,11 +156,13 @@ }; # A kubenix configuration is published as - # `packages..`, its result. + # `kubenixConfigurations..`, the evaluation kubenix's + # `evalModules` returns, whose `config.kubernetes.result` is its + # result. exportsTo = { - attrset = "packages"; + attrset = "kubenixConfigurations"; bySystem = true; - value = manifest: manifest.outputs.result; + value = manifest: manifest.value; }; configuration = diff --git a/tests/pinned-world/default.nix b/tests/pinned-world/default.nix index 77f8a94c..0d6df59d 100644 --- a/tests/pinned-world/default.nix +++ b/tests/pinned-world/default.nix @@ -1890,9 +1890,10 @@ let && builtins.elem "alpha" (builtins.attrNames topology.config.nodes) && topology.config.output.drvPath == upstream.config.output.drvPath; - # A kubenix configuration is published as `packages..`, - # its result, which is the result kubenix's own `evalModules` gives - # the same module on the same package set. + # A kubenix configuration is published as + # `kubenixConfigurations..`, its evaluation, whose + # result is the result kubenix's own `evalModules` gives the same + # module on the same package set. kubenixIsTheResultKubenixBuilds = let module = @@ -1914,7 +1915,8 @@ let }; upstream = import "${inputs.kubenix}/lib/eval-modules.nix" { inherit pkgs; } { inherit module; }; in - top.packages.x86_64-linux.cluster.drvPath == upstream.config.kubernetes.result.drvPath; + top.kubenixConfigurations.x86_64-linux.cluster.config.kubernetes.result.drvPath + == upstream.config.kubernetes.result.drvPath; # A nixidy configuration is published as # `nixidyEnvs..`, and its rendered environment is the From 67e6c70625d6989f3e8d385d68ff92f2e66e97ad Mon Sep 17 00:00:00 2001 From: Chris Hodapp Date: Sat, 17 Oct 2026 22:57:43 -0700 Subject: [PATCH 5/5] maint: say a configuration is evaluated per system in every integration The comments of the integrations said a configuration is evaluated at every system in force, and one in the integrations library said a configuration is evaluated at a system. They say it is evaluated per system, once for each system in force. Co-Authored-By: Claude Opus 5.5 --- lib-overlays/darwin/default.nix | 4 ++-- lib-overlays/hjem/default.nix | 2 +- lib-overlays/home-manager/default.nix | 4 ++-- lib-overlays/integrations/default.nix | 5 +++-- lib-overlays/kubenix/default.nix | 2 +- lib-overlays/nixidy/default.nix | 2 +- lib-overlays/nixos/default.nix | 2 +- lib-overlays/nixvim/default.nix | 4 ++-- lib-overlays/nvf/default.nix | 2 +- lib-overlays/terranix/default.nix | 2 +- lib-overlays/treefmt/default.nix | 2 +- 11 files changed, 16 insertions(+), 15 deletions(-) diff --git a/lib-overlays/darwin/default.nix b/lib-overlays/darwin/default.nix index 1b3c605a..bcaff53f 100644 --- a/lib-overlays/darwin/default.nix +++ b/lib-overlays/darwin/default.nix @@ -2,8 +2,8 @@ # # The darwin integration: it owns the `darwin` class and evaluates it # with nix-darwin's `eval-config.nix`, over the composed library. A -# darwin configuration is a macOS machine, evaluated at every system -# in force where it is declared, as a NixOS configuration is, and +# darwin configuration is a macOS machine, evaluated per system, +# once for each system in force where it is declared, as a NixOS configuration is, and # published as `darwinConfigurations.`, the value `darwin-rebuild` # reads: the evaluated configuration with its `system` beside it. # diff --git a/lib-overlays/hjem/default.nix b/lib-overlays/hjem/default.nix index c2dcf188..0238c0d4 100644 --- a/lib-overlays/hjem/default.nix +++ b/lib-overlays/hjem/default.nix @@ -2,7 +2,7 @@ # # The hjem integration: it owns the `hjem` class, hjem's class for the # files and packages of a user. A hjem configuration is the home of a -# user, evaluated at every system in force where it is declared. +# user, evaluated per system, once for each system in force where it is declared. # # hjem itself evaluates a user only inside its NixOS and nix-darwin # modules, as a submodule of `hjem.users`; its standalone CLI evaluates diff --git a/lib-overlays/home-manager/default.nix b/lib-overlays/home-manager/default.nix index 9674b65b..909e915b 100644 --- a/lib-overlays/home-manager/default.nix +++ b/lib-overlays/home-manager/default.nix @@ -4,7 +4,7 @@ # contributes the declared home-manager's library to the composition # as `lib.hm`, and evaluates the class over the composed library with # home-manager's module list. A home is a configuration: it is -# evaluated at every system in force where it is declared, on the +# evaluated per system, once for each system in force where it is declared, on the # package set in force there, and a top publishes it under # `homeConfigurations`. # @@ -531,7 +531,7 @@ # `caisson.home-manager.configurations.` finalizes it, # and `mkTopConfiguration` finalizes it at a top. # `lib.caisson.home-manager-minimal` takes the same arguments. - # The home is evaluated at every system in force where it is + # The home is evaluated per system, once for each system in force where it is # declared, and its package sets come from the composition, # through the manifest; `defaultPkgs` selects the set it runs # on. diff --git a/lib-overlays/integrations/default.nix b/lib-overlays/integrations/default.nix index 6c8e20c3..ad8543ff 100644 --- a/lib-overlays/integrations/default.nix +++ b/lib-overlays/integrations/default.nix @@ -676,8 +676,9 @@ # declared beneath it, nested ones included: for each, its # manifest, the output attribute set it is published under, the # value published, and its path from here, a list of - # `{ type, name }` segments. A configuration evaluated at a - # system has that system above its name on the path. `selected` + # `{ type, name }` segments. An evaluation of a configuration + # evaluated per system has its system above its name on the + # path. `selected` # is what each integration's `exported` selected, by integration # and then name, each value a manifest or the evaluations of a # configuration by system. A configuration whose manifest diff --git a/lib-overlays/kubenix/default.nix b/lib-overlays/kubenix/default.nix index 56ec2989..15ef13dc 100644 --- a/lib-overlays/kubenix/default.nix +++ b/lib-overlays/kubenix/default.nix @@ -4,7 +4,7 @@ # kubenix's modules. A kubenix configuration is a set of Kubernetes # resources written as kubenix modules, which import the kubenix modules # they use from the `kubenix` argument (`kubenix.modules.k8s`). It is -# evaluated at every system in force where it is declared, on the +# evaluated per system, once for each system in force where it is declared, on the # package set selected for it. # # kubenix evaluates its modules with its `evalModules`: `evalModules` on diff --git a/lib-overlays/nixidy/default.nix b/lib-overlays/nixidy/default.nix index 82e9692d..2d837bfe 100644 --- a/lib-overlays/nixidy/default.nix +++ b/lib-overlays/nixidy/default.nix @@ -3,7 +3,7 @@ # The nixidy integration: it owns the `nixidy` class, the class of # nixidy's modules. A nixidy configuration is an environment of Argo CD # applications, written as nixidy modules (`applications.*`, -# `nixidy.target`). It is evaluated at every system in force where it +# `nixidy.target`). It is evaluated per system, once for each system in force where it # is declared, on the package set selected for it. # # caisson evaluates it with nixidy's own `mkEnv`, the function the diff --git a/lib-overlays/nixos/default.nix b/lib-overlays/nixos/default.nix index 037b5fcd..42e02d6d 100644 --- a/lib-overlays/nixos/default.nix +++ b/lib-overlays/nixos/default.nix @@ -135,7 +135,7 @@ # `mkTopConfiguration` finalizes it at a top. The colmena node # constructors take the same arguments, and # `lib.caisson.nixos-minimal` these plus `prefix`. The - # configuration is evaluated at every system in force where it + # configuration is evaluated per system, once for each system in force where it # is declared, and its package sets come from the composition, # through the manifest; `defaultPkgs` selects the set it runs # on. diff --git a/lib-overlays/nixvim/default.nix b/lib-overlays/nixvim/default.nix index cb955d8a..0963bf41 100644 --- a/lib-overlays/nixvim/default.nix +++ b/lib-overlays/nixvim/default.nix @@ -2,8 +2,8 @@ # # The nixvim integration: it owns the `nixvim` class, the class of # nixvim's modules. A nixvim configuration is a Neovim, written as -# nixvim modules (`plugins.*`, `opts`, `keymaps`), evaluated at every -# system in force where it is declared, on the package set selected for +# nixvim modules (`plugins.*`, `opts`, `keymaps`), evaluated per +# system, once for each system in force where it is declared, on the package set selected for # it. # # nixvim evaluates its modules with `evalNixvim`: `evalModules` over diff --git a/lib-overlays/nvf/default.nix b/lib-overlays/nvf/default.nix index 83d924fa..d53a2593 100644 --- a/lib-overlays/nvf/default.nix +++ b/lib-overlays/nvf/default.nix @@ -2,7 +2,7 @@ # # The nvf integration: it owns the `nvf` class, the class of nvf's # modules. An nvf configuration is a Neovim, written as nvf modules -# (`vim.*`), evaluated at every system in force where it is declared, +# (`vim.*`), evaluated per system, once for each system in force where it is declared, # on the package set selected for it. # # nvf evaluates its modules with `neovimConfiguration`, on nixpkgs' diff --git a/lib-overlays/terranix/default.nix b/lib-overlays/terranix/default.nix index 7939c1fe..30217ea6 100644 --- a/lib-overlays/terranix/default.nix +++ b/lib-overlays/terranix/default.nix @@ -3,7 +3,7 @@ # The terranix integration: it owns the `terranix` class and # evaluates it with `terranixConfiguration` from the terranix flake. A # terranix configuration is a Terraform configuration written as -# modules, evaluated at every system in force where it is declared, +# modules, evaluated per system, once for each system in force where it is declared, # on the package set selected for it. # # Its output is `json`, the `config.tf.json` file Terraform reads, diff --git a/lib-overlays/treefmt/default.nix b/lib-overlays/treefmt/default.nix index 74440405..4b887826 100644 --- a/lib-overlays/treefmt/default.nix +++ b/lib-overlays/treefmt/default.nix @@ -3,7 +3,7 @@ # The treefmt integration: it owns the `treefmt` class, the class of # treefmt-nix's modules. A treefmt configuration is the formatters of a # tree: `programs..enable` and `settings`, as treefmt-nix writes -# them. It is evaluated at every system in force where it is declared, +# them. It is evaluated per system, once for each system in force where it is declared, # on the package set selected for it. # # treefmt-nix evaluates its modules with `evalModules` on the library of