Include in nixpkgs a python library that do no build with old python

I’d like to include in nixpkgs/top-level/python-packages.nix a python library, but the library does not work with python older than 3.5. What is the proper way to solve that issue?

The trick (thanks mvnetbiz_) is to use the disabled argument of buildPythonPackage, together with pythonOlder "3.5". Note that pythonOlder needs to appear as well in the input parameters:

{ stdenv, buildPythonPackage, fetchPypi, pythonOlder }:
buildPythonPackage rec {
  pname = "mylibraryname";
  version = "2.0.1";
  disabled = pythonOlder "3.5";
  # ...
}

More reading here.

1 Like