Nix develop rebuilds Python packages

I have created the following flake.nix:

{
  description = "My development environment";

  inputs = {
    nixpkgs = { url = "github:nixos/nixpkgs/nixpkgs-unstable"; };
  };

  outputs = inputs:
    let
      pkgs = import inputs.nixpkgs { system = "x86_64-linux"; };
      requirements = with pkgs; (ps: with ps; [
          numpy
          scipy
          meshio
          matplotlib
          ipython
          pytest
          pyamg
          mypy
          flake8
          sphinx
          autograd
          pep517
          twine
          pip
      ]);
    in {
      devShells.x86_64-linux.default = inputs.nixpkgs.legacyPackages.x86_64-linux.mkShell {
        buildInputs = [ (pkgs.python310.withPackages requirements) ];
      };
      devShells.x86_64-linux.py311 = inputs.nixpkgs.legacyPackages.x86_64-linux.mkShell {
        buildInputs = [ (pkgs.python311.withPackages requirements) ];
      };
    };
}

If I run nix develop it installs Python 3.10 and all the packages from cache.nixos.org and finishes in about 1 minute. However, if I run nix develop .#py11 it starts to build a huge number of packages and the command takes about 60 minutes to finish. Is there something I can do to avoid this? Is there a way to debug which package causes all the rebuilds?

1 Like

Is it because python311Packages are not being built by Hydra? I couldn’t find anything starting with python311Packages at hydra.nixos.org.