Thanks for the pointers all.
This turned out to be a weirder issue.
I tried using --derivationto figure this out. Also with nix-tree. When I disabled the CVE, I could get my system to build. But Pypy2.7 is apparently not part of any build-time closure of any of the package.
Packages that have errorred out when building, with the CVE enabled, all use Python3.13. Furthermore, this showed up in seemingly random places (first it was neovim, then after commenting that out, it showed up in autorandr postswitch hook, then in i3).
After another long debugging session, I got a hunch that something is off with my Python setting in general.
I isolated it down to a custom overlay that I made in a custom flake I had. In this flake, I package some private Python packages into nix and I want to make it available under e.g. pkgs.Python314Packages.{mynamespace}.{mypackage}.
For some reason that I can’t explain, this overlay fails only in Python3.13. When I comment out that overlay, then it could build just fine even with the CVEs included. Perhaps it’s because those derivations that failed earlier (nvim, etc) uses Python3.13. I did not investigate enough further. For now, I just commented out the python313 overlay then and everything seems to work.
For reference, here’s the custom overlay. In the flake repo, this is under overlays/default.nix. This overlay also adds e.g. pkgs.{mynamespace}.{nonpythonpackage} to make non-Python packages available under mynamespace.
{ flake }:
let
inherit (flake.inputs.nixpkgs) lib;
supportedPythons = [
"python310"
"python311"
"python312"
# FIXME: Including this in the overlay breaks downstream builds.
# "python313"
"python314"
];
in
{
default =
let
pythonOverrides = pyfinal: _pyprev: {
mynamespace = {
mypackage1 = pyfinal.callPackage ../packages/mypackage1 { };
mypackage2 = pyfinal.callPackage ../packages/mypackage2 { };
};
};
mkPythons =
prev:
lib.genAttrs supportedPythons (
pyname: prev.${pyname}.override { packageOverrides = pythonOverrides; }
);
in
final: prev:
(
{
mynamespace = import ../packages {
inherit flake;
pkgs = final;
};
}
// (mkPythons prev)
);
}
I have checked to ensure that mynamespace does not cause any collisions (i.e. there is no e.g. pkgs.python313Packages{mynamespace} in nixpkgs.