Skip to content

flake: fix legacyPackages evaluation and double-applied overlays - #20

Merged
jonringer merged 2 commits into
masterfrom
jonringer/fix-flake-legacy-packages
Nov 13, 2026
Merged

jonringer merged 2 commits into
masterfrom
jonringer/fix-flake-legacy-packages

Conversation

@jonringer

Copy link
Copy Markdown
Collaborator

Problem

legacyPackages is broken on master:

$ nix eval .#legacyPackages.x86_64-linux.python3Packages.requests.drvPath
error: function 'anonymous lambda' called with unexpected argument 'system'
       at default.nix:5:1

nix flake check --no-build doesn't catch it because it never forces anything inside legacyPackages.

Root cause

f3bccf5 ("default.nix: clean up module logic") changed default.nix's formals from { overlays ? [ ], config ? { }, ... } to { modules ? [ ] } and dropped the .... The flake still calls import ./. { inherit system; ... }, so the call fails. default.nix already forwards any remaining args to corepkgs through filteredAttrs, but the strict formals reject them first.

The flake also had a second bug, the same one as ekapkgs#141. It passed modules = [ pkgsModule ], but default.nix already appends ./pkgs-module.nix. The module is an anonymous function with no key, so evalModules doesn't dedupe it, and every overlay was applied twice: config.overlays.python and config.overlays.pkgs each had 4 entries instead of 2. ci/repos-packages.nix did the same thing.

Fix

  1. flake: fix legacyPackages evaluation: add ... to default.nix's formals so system (and any other corepkgs argument) is passed through, as in haskell-pkgs' default.nix. Make the flake call import ./. { inherit system; }, the way corepkgs' flake does, without adding pkgs-module.nix a second time.
  2. ci/repos-packages: stop passing pkgs-module.nix to ./. a second time.

Other outputs

The other outputs are only formatter (corepkgs.formatter, which evaluates fine) and nixConfig. There are no packages, checks or devShells. nixConfig sits inside outputs, so Nix ignores it ("unknown flake output"). corepkgs and ekapkgs do the same, so I've left it alone.

Verification

  • nix eval .#legacyPackages.x86_64-linux.python3Packages.requests.drvPath: fails on master, and on this branch returns /nix/store/7p2fff2g…-python3.13-requests-2.34.2.drv, the same as import ./. {}.
  • The flake gives the same drvPaths as import ./. {} for requests, numpy, scipy, pandas, matplotlib, django, qhull, xsimd and curl. It also matches on a 200-attribute stride sample of python3Packages: no differences, 199 evaluated, and 1 fails in both. Both entry points now have 2 python and 2 pkgs overlays.
  • ci/repos-packages.nix: all 83 drvPaths are the same before and after. The overlays turned out to be idempotent, so the duplicate only cost evaluation time there.
  • nix flake check --no-build passes.
  • ci/eval.sh reports "All 7238 packages evaluate.", the same as master.
  • Formatting: I checked the changed files with nixfmt from nixfmt-rs 0.4.1 rather than nix fmt.

This branch doesn't depend on #19, and it doesn't conflict with it: #19 only touches pins.nix and fetch-locked.nix.

default.nix only accepted `modules`, so the flake's `inherit system;`
failed with "unexpected argument 'system'". Accept and pass through
any other arguments to corepkgs, as haskell-pkgs does.

The flake also passed pkgs-module.nix in `modules`, which default.nix
already appends, so every overlay was applied twice through the flake.
Stop passing it.
default.nix already appends pkgs-module.nix to the modules it passes to
corepkgs, so passing it again applied every overlay twice.
@jonringer
jonringer force-pushed the jonringer/fix-flake-legacy-packages branch from cec95cf to b28fe29 Compare November 13, 2026 22:16
@jonringer
jonringer merged commit a8c2bf0 into master Nov 13, 2026
2 checks passed
@jonringer
jonringer deleted the jonringer/fix-flake-legacy-packages branch November 13, 2026 22:17
@jonringer
jonringer restored the jonringer/fix-flake-legacy-packages branch November 28, 2026 16:25
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