1{ stdenv 2, lib 3, buildPythonPackage 4, pythonOlder 5, isPyPy 6, fetchPypi 7, postgresql 8, openssl 9}: 10 11buildPythonPackage rec { 12 pname = "psycopg2"; 13 version = "2.9.1"; 14 15 # Extension modules don't work well with PyPy. Use psycopg2cffi instead. 16 # c.f. https://github.com/NixOS/nixpkgs/pull/104151#issuecomment-729750892 17 disabled = pythonOlder "3.6" || isPyPy; 18 19 src = fetchPypi { 20 inherit pname version; 21 sha256 = "0z0v2d5gpgy0wf2ypqxv955c9k44yszd7r20km5s79yhy6k06lyy"; 22 }; 23 24 nativeBuildInputs = [ 25 postgresql 26 ]; 27 28 buildInputs = lib.optionals stdenv.isDarwin [ 29 openssl 30 ]; 31 32 # requires setting up a postgresql database 33 doCheck = false; 34 35 meta = with lib; { 36 description = "PostgreSQL database adapter for the Python programming language"; 37 homepage = "https://www.psycopg.org"; 38 license = with licenses; [ lgpl3 zpl20 ]; 39 }; 40}