1{ 2 lib, 3 buildPythonPackage, 4 fetchPypi, 5 setuptools-scm, 6 # install requirements 7 six, 8 fido2, 9 keyring, 10 cryptography, 11 # test requirements 12 pytestCheckHook, 13 unittestCheckHook, 14 mock, 15}: 16 17let 18 fido2_0 = fido2.overridePythonAttrs (oldAttrs: rec { 19 version = "0.9.3"; 20 src = fetchPypi { 21 inherit (oldAttrs) pname; 22 inherit version; 23 hash = "sha256-tF6JphCc/Lfxu1E3dqotZAjpXEgi+DolORi5RAg0Zuw="; 24 }; 25 postPatch = '' 26 substituteInPlace setup.py test/test_attestation.py \ 27 --replace-fail "distutils.version" "setuptools._distutils.version" 28 ''; 29 build-system = [ setuptools-scm ]; 30 dependencies = oldAttrs.dependencies ++ [ six ]; 31 nativeCheckInputs = [ 32 unittestCheckHook 33 mock 34 ]; 35 }); 36in 37buildPythonPackage rec { 38 pname = "ctap-keyring-device"; 39 version = "1.0.6"; 40 pyproject = true; 41 42 src = fetchPypi { 43 inherit version pname; 44 hash = "sha256-pEJkuz0wxKt2PkowmLE2YC+HPYa2ZiENK7FAW14Ec/Y="; 45 }; 46 47 # removing optional dependency needing pyobjc 48 postPatch = '' 49 substituteInPlace pytest.ini \ 50 --replace "--flake8 --black --cov" "" 51 ''; 52 53 pythonRemoveDeps = [ 54 # This is a darwin requirement missing pyobjc 55 "pyobjc-framework-LocalAuthentication" 56 ]; 57 58 build-system = [ setuptools-scm ]; 59 60 dependencies = [ 61 keyring 62 fido2_0 63 cryptography 64 ]; 65 66 pythonImportsCheck = [ "ctap_keyring_device" ]; 67 68 nativeCheckInputs = [ pytestCheckHook ]; 69 70 disabledTests = [ 71 # Disabled tests that needs pyobjc or windows 72 "touch_id_ctap_user_verifier" 73 "windows_hello_ctap_user_verifier" 74 ]; 75 76 meta = with lib; { 77 description = "CTAP (client-to-authenticator-protocol) device backed by python's keyring library"; 78 homepage = "https://github.com/dany74q/ctap-keyring-device"; 79 license = licenses.mit; 80 maintainers = with maintainers; [ jbgosselin ]; 81 }; 82}