Skip to content

Resolve each part of the nixpkgs stack from its own key, selected from the sources - #128

Merged
clhodapp merged 5 commits into
mainfrom
feat/separate-nixpkgs-parts
Oct 22, 2026
Merged

clhodapp merged 5 commits into
mainfrom
feat/separate-nixpkgs-parts

Conversation

@clhodapp

@clhodapp clhodapp commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Builds on nix-caisson/caisson-core#53, merged, which makes defaultEcosystemSrc a selection. The locks pin caisson-core main at its merge commit, 9e1bdf6.

A nixpkgs checkout holds three parts that caisson treats as separate layers. Each is resolved from its own key, with no fallback between keys:

Part Key Read by
the library (lib/, with the module system) nixpkgs-lib the nixpkgs-lib entry of every lib
the package set and its configuration nixpkgs package configs; nix-darwin's nixpkgs.source
the NixOS module collection (nixos/modules, nixos/lib/eval-config.nix) nixos NixOS configurations, and system-manager for its NixOS modules

Until now, the nixpkgs-lib entry fell back to the nixpkgs key, and NixOS and system-manager read nixpkgs. The parts are separate so that they can come from different sources on purpose. A tree that takes them all from one checkout names it under each key.

Selections. ecosystemSrc on a configuration is now a function of the tree's pinned sources, ecosystemSrc = sources: sources.nixpkgs-stable;, as defaultEcosystemSrc is with #53, and as defaultPkgs already is for package sets. A value is refused. resolveEcosystemSrc applies the selection, so every integration that resolves through it takes the function. flake-parts reads its source directly, and applies it through the new selectedEcosystemSrc.

An override replaces its integration's part for that evaluation and nothing else. A NixOS configuration that selects another module collection runs it on the tree's lib.

The package-set libraries come from the package set's source. nixpkgs' library holds general utilities and the module system, which serve every evaluation, and package-set libraries, which describe and build packages: systems and platforms, meta, licenses, sourceTypes, maintainers and teams, customisation, derivations, fetchers and versions. A package set's lib now takes those libraries from the package set's source, together with the names nixpkgs publishes from them at the top level of its library, such as getExe and callPackageWith. A name that a general library also defines, such as compareVersions, stays with the general library. The general utilities and the module system keep coming from nixpkgs-lib.

The packages of a set are written against the package-set libraries at the revision of the set. With this, a package set builds on a library from the nixpkgs.lib mirror, which holds only lib/ and follows nixpkgs master. nixpkgs reads maintainers and teams from its maintainers directory beside lib/, and checks the maintainers of every derivation it creates. ch-firmware's nixos-26.05 package set failed on the 26.11 mirror before this change, on lib.licenses.gfl and then on hostPlatform.linux-kernel. Its full nix flake check passes on the mirror with it.

The new nixpkgs-lib-only integration test builds a package set on a library that holds only lib/. Its lib overlay marks getExe and splitString in the composed lib, and the test checks that the package set's lib replaces the first and keeps the second.

Breaking. Every tree must declare the keys of the parts it uses. With an input named nixpkgs, that's:

defaultEcosystemSrc = sources: { nixpkgs-lib = sources.nixpkgs; nixos = sources.nixpkgs; };

and every ecosystemSrc = inputs.X becomes ecosystemSrc = sources: sources.X. The workspace consumers follow in PRs of their own, which pin this change.

Tests. Every test tree and example declares the keys it uses, with its sources pinned and selected. A new unit test checks that an ecosystemSrc given as a value is refused. nix flake check passes locally, including the VM tests and the evaluation-cost gate.

🤖 Generated with Claude Code

…ed from the sources

A nixpkgs checkout holds three parts that caisson treats as separate
layers, each resolved from a key of its own with no fallback between
keys:

- `nixpkgs-lib`, the library, which the `nixpkgs-lib` entry composes
  into the lib. It no longer falls back to the `nixpkgs` key.
- `nixpkgs`, the package set and its configuration. Unchanged.
- `nixos`, the NixOS module collection: `nixos/modules` and
  `nixos/lib/eval-config.nix`. The nixos integration, and the NixOS
  modules system-manager reads, resolve it; they resolved `nixpkgs`.

`ecosystemSrc` on a configuration is now a selection from the tree's
pinned sources, a function of `sources` (`sources: sources.<name>`),
as `defaultEcosystemSrc` on mkLib now is (caisson-core). A value is
refused. `resolveEcosystemSrc` applies the selection, so every
integration that resolves through it takes the function, and
flake-parts applies it through the new `selectedEcosystemSrc`.

An override replaces the part of its integration for that evaluation
and nothing else: a NixOS configuration that selects another module
collection runs it on the lib of the tree.

Every test tree and example declares the keys of the parts it uses,
with its sources pinned and selected. A new unit test checks that an
`ecosystemSrc` given as a value is refused. caisson is pinned to the
caisson-core branch that makes `defaultEcosystemSrc` a selection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nixpkgs reads lib.maintainers and lib.teams from its maintainers
directory, beside lib/, and checks the maintainers of every derivation
it creates. A composition whose library comes from the nixpkgs.lib
mirror has neither file. Inside a package set, the nixpkgs integration
now takes both attributes from the library of the package set's own
source. The nixpkgs-lib-only integration test builds a package set on
a library that holds only lib/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clhodapp added a commit to clhodapp/big-console that referenced this pull request Oct 22, 2026
The root flake takes its library from the nixpkgs.lib mirror, and flake-parts follows that input. Inside a package set, caisson takes lib.maintainers and lib.teams from the nixpkgs source of that package set. The locks pin caisson to the latest commit of nix-caisson/caisson#128.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clhodapp added a commit to clhodapp/ch-ai-workbench that referenced this pull request Oct 22, 2026
The root flake takes its library from the nixpkgs.lib mirror, and flake-parts follows that input. Inside a package set, caisson takes lib.maintainers and lib.teams from the nixpkgs source of that package set. The locks pin caisson to the latest commit of nix-caisson/caisson#128.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clhodapp added a commit to clhodapp/ch-emacs-config that referenced this pull request Oct 22, 2026
The root flake takes its library from the nixpkgs.lib mirror, and flake-parts follows that input. Inside a package set, caisson takes lib.maintainers and lib.teams from the nixpkgs source of that package set. The locks pin caisson to the latest commit of nix-caisson/caisson#128.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clhodapp added a commit to clhodapp/ch-zsh-config that referenced this pull request Oct 22, 2026
The root flake takes its library from the nixpkgs.lib mirror, and flake-parts follows that input. Inside a package set, caisson takes lib.maintainers and lib.teams from the nixpkgs source of that package set. The locks pin caisson to the latest commit of nix-caisson/caisson#128.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clhodapp added a commit to clhodapp/edk2-platforms-nix that referenced this pull request Oct 22, 2026
The root flake takes its library from the nixpkgs.lib mirror, and flake-parts follows that input. Inside a package set, caisson takes lib.maintainers and lib.teams from the nixpkgs source of that package set. The locks pin caisson to the latest commit of nix-caisson/caisson#128.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clhodapp added a commit to clhodapp/flake-sync that referenced this pull request Oct 22, 2026
The root flake takes its library from the nixpkgs.lib mirror, and flake-parts follows that input. Inside a package set, caisson takes lib.maintainers and lib.teams from the nixpkgs source of that package set. The locks pin caisson to the latest commit of nix-caisson/caisson#128.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clhodapp added a commit to clhodapp/nbd-nix that referenced this pull request Oct 22, 2026
The root flake takes its library from the nixpkgs.lib mirror, and flake-parts follows that input. Inside a package set, caisson takes lib.maintainers and lib.teams from the nixpkgs source of that package set. The locks pin caisson to the latest commit of nix-caisson/caisson#128.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clhodapp added a commit to clhodapp/uefi-shell-launcher that referenced this pull request Oct 22, 2026
The root flake takes its library from the nixpkgs.lib mirror, and flake-parts follows that input. Inside a package set, caisson takes lib.maintainers and lib.teams from the nixpkgs source of that package set. The locks pin caisson to the latest commit of nix-caisson/caisson#128.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clhodapp added a commit to clhodapp/merman-nix that referenced this pull request Oct 22, 2026
The root flake takes its library from the nixpkgs.lib mirror, and flake-parts follows that input. Inside a package set, caisson takes lib.maintainers and lib.teams from the nixpkgs source of that package set. The locks pin caisson to the latest commit of nix-caisson/caisson#128.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clhodapp and others added 3 commits October 21, 2026 22:41
…ource

Packages name the licenses and source types of the nixpkgs revision of
their package set. Inside a package set, the nixpkgs integration now
takes lib.licenses and lib.sourceTypes from the library of the package
set's source, as it takes maintainers and teams.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…source

nixpkgs' library holds general utilities and the module system, which
serve every evaluation, and package-set libraries, which describe and
build packages: systems and platforms, meta, licenses, sourceTypes,
maintainers and teams, customisation, derivations, fetchers and
versions. The packages of a set are written against the package-set
libraries at the revision of the set. A package set's lib now takes
those libraries from the package set's source, with the names nixpkgs
publishes from them at the top level, such as getExe and
callPackageWith. A name that a general library also defines stays with
the general library. This replaces the four attributes taken before.

The nixpkgs-lib-only test marks getExe and splitString in the composed
lib and checks that the package set's lib replaces the first and keeps
the second.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@clhodapp
clhodapp merged commit 4bf4270 into main Oct 22, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant