DavHau / mach-nix

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

How to change flake to python310? #556

Open waynee95 opened 1 year ago

waynee95 commented 1 year ago

Currently I have the following flake:

{
  inputs = {
    mach-nix.url = "mach-nix/3.5.0";
  };

  outputs = {self, nixpkgs, mach-nix}:
    let
      l = nixpkgs.lib // builtins;
      supportedSystems = [ "x86_64-linux" "aarch64-darwin" ];
      forAllSystems = f: l.genAttrs supportedSystems
        (system: f system (import nixpkgs {inherit system;}));
    in
    {
      # enter this python environment by executing `nix shell .`
      defaultPackage = forAllSystems (system: pkgs: mach-nix.lib."${system}".mkPython {
        # python = "python310";
        requirements = ''
          jupyter_contrib_nbextensions
          RISE
        '';
      });
    };
}

I would like to use version python310.

I tried following https://github.com/DavHau/mach-nix/issues/504 but that didn't work.

TyberiusPrime commented 1 year ago
{
  inputs = {
    mach-nix.url = "mach-nix/3.5.0";
  };

  outputs = {
    self,
    nixpkgs,
    mach-nix,
  }: let
    l = nixpkgs.lib // builtins;
    supportedSystems = ["x86_64-linux" "aarch64-darwin"];
    forAllSystems = f:
      l.genAttrs supportedSystems
      (system: f system (import nixpkgs {inherit system;}));
  in {
    # enter this python environment by executing `nix shell .`
    defaultPackage = forAllSystems (system: pkgs: let
      mach-nix_ = import mach-nix {
        inherit pkgs;
        python = "python310";
      };
    in
      mach-nix_.mkPython {
        # python = "python310";
        requirements = ''
          jupyter_contrib_nbextensions
          RISE
        '';
      });
  };
}
hakan-demirli commented 7 months ago

I get > packaging.version.InvalidVersion: Invalid version: 'unstable-2023-05-04 when I use that flake.

TyberiusPrime commented 7 months ago

Give the current master a try, I did some work around such issues a few months back.