DavHau / mach-nix

Create highly reproducible python environments
MIT License
853 stars 105 forks source link

Support for python 3.11 #514

Open chaoflow opened 1 year ago

chaoflow commented 1 year ago

We have python311 in nixpkgs, however, using it in the following flake fails:

{
  inputs.flake-utils.url = "github:numtide/flake-utils";
  inputs.mach-nix.url = "mach-nix";
  inputs.mach-nix.inputs.flake-utils.follows = "flake-utils";
  inputs.mach-nix.inputs.nixpkgs.follows = "nixpkgs";
  inputs.mach-nix.inputs.pypi-deps-db.follows = "pypi-deps-db";
  inputs.pypi-deps-db.url = "github:DavHau/pypi-deps-db";
  inputs.pypi-deps-db.inputs.mach-nix.follows = "mach-nix";
  inputs.pypi-deps-db.inputs.nixpkgs.follows = "nixpkgs";

  outputs = {
      self,
      nixpkgs,
      flake-utils,
      mach-nix,
      pypi-deps-db,
  }:
    flake-utils.lib.eachDefaultSystem (
      system: let
        pkgs = nixpkgs.legacyPackages.${system};
        l = nixpkgs.lib // builtins;
        requirements =
          l.concatStringsSep "\n" [
            "build"
          ];
        mach = mach-nix.lib.${system};
        pyenv = mach.mkPython {
          inherit requirements;
          # python = "python38";
          # python = "python39";
          # python = "python310";
          python = "python311";
        };
      in {
        devShell = pkgs.mkShell {
          buildInputs = with pkgs; [
            pyenv
          ];
        };
      }
    );
}
chaoflow commented 1 year ago
❯ nix develop             
error: attribute 'linux_py_311_cpu' missing

       at /nix/store/mhkhnp41briffzh0fq3nsmrfzncxqxcn-source/pkgs/development/python-modules/tensorflow/bin.nix:57:15:

           56|     key = "${platform}_py_${pyVerNoDot}_${unit}";
           57|   in fetchurl packages.${key};
             |               ^
           58|
       Did you mean one of linux_py_310_cpu, linux_py_310_gpu, linux_py_37_cpu, linux_py_38_cpu or linux_py_39_cpu?
(use '--show-trace' to show detailed location information)
TyberiusPrime commented 1 year ago

I think pypi-deps-db also has no entries for 3.11 so far.