DavHau / mach-nix

Create highly reproducible python environments
MIT License
862 stars 106 forks source link

Weird behavior with nixos-22.05 #481

Open PierreR opened 2 years ago

PierreR commented 2 years ago

Using nixos-22.05.1043.5afb1b7dcf4 with the latest mach-nix 3.5.0, this kind of snippet (that worked before with 21.11):

  artifactory-du = mach-nix.buildPythonPackage {
    src = mach-nix.fetchPypiSdist "artifactory-du" "1.0.5";
    requirementsExtra = "setuptools-rust";
  };

is now asking for a pname, a version and wants me to replace requirementsExtra with requirements.

I am pretty sure (not 100%) it will work with mach-nix 3.5.0 and nixos-21.11 so something in a more recent version of nixpkgs seems to interfere badly.

Any idea ?

Cheers

bjornfor commented 2 years ago

This looks like issue https://github.com/DavHau/mach-nix/issues/467. There's a fix here that hopefully lands soon: https://github.com/DavHau/mach-nix/pull/474.

(I think this can be closed as a duplicate.)

PierreR commented 2 years ago

Using 51caf58 (with the fix) it doesn't seem to solve the issue

bjornfor commented 2 years ago

Can you make a self contained repro?

PierreR commented 2 years ago

@bjornfor here is a self-contained repro:

shell.nix

let
  overlay = (
    self: super:
    let
      mach-nix = import (super.fetchFromGitHub {
          owner = "DavHau";
          repo = "mach-nix";
          rev = "51caf584f26acdfaa51bbf7ee1ffa365aea7bc64";
          sha256 = "sha256-qSjk1iOi14ijAOP6QuGfE3fvy08aVxsgus+ArwgiyuU=";
      }) { };
    in
    {
      artifactory-du = mach-nix.buildPythonPackage {
        src = mach-nix.fetchPypiSdist "artifactory-du" "1.0.5";
        requirementsExtra = "setuptools-rust";
    };
    }
  );
  pkgs = import
    (builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/5afb1b7dcf4.tar.gz")
    { overlays = [ overlay ]; };
in
pkgs.mkShell {
  buildInputs = with pkgs;[
    artifactory-du
  ];
}

$ nix-shell shell.nix

error: Automatic extraction of 'pname' from python package source /nix/store/x173ipldnzpb5bpxpxv8s9g4jlhhfvsj-artifactory-du-1.0.5.tar.gz failed.
       Please manually specify 'pname'

If I specify the pname I will get an error about version and if I give it, I will have the error Please manually specify 'requirements'

Using mach-nix 3.5.0, if instead of 5afb1b7dcf4 I use a ref commit from 21.11, it works.