1{ lib, buildPythonPackage, fetchFromGitHub, cacert, openssl, python, nixosTests
2
3, cryptography, pyrad, pymysql, python-dateutil, flask-versioned, flask_script
4, defusedxml, croniter, flask_migrate, pyjwt1, configobj, sqlsoup, pillow
5, python-gnupg, passlib, pyopenssl, beautifulsoup4, smpplib, flask-babel
6, ldap3, huey, pyyaml, qrcode, oauth2client, requests, lxml, cbor2, psycopg2
7, pydash, ecdsa
8
9, mock, pytestCheckHook, responses, testfixtures
10}:
11
12buildPythonPackage rec {
13 pname = "privacyIDEA";
14 version = "3.5.2";
15
16 src = fetchFromGitHub {
17 owner = pname;
18 repo = pname;
19 rev = "v${version}";
20 sha256 = "sha256-k2om2LjkFRCT53ECPAJEztCiMdz4fF5eoipVUvSoyGo=";
21 fetchSubmodules = true;
22 };
23
24 patches = [
25 # Subset of https://github.com/privacyidea/privacyidea/commit/359db6dd10212b8a210e0a83536e92e9e796a1f8,
26 # fixes app context errors in tests. Can be removed on the next bump.
27 ./fix-tests.patch
28 ];
29
30 propagatedBuildInputs = [
31 cryptography pyrad pymysql python-dateutil flask-versioned flask_script
32 defusedxml croniter flask_migrate pyjwt1 configobj sqlsoup pillow
33 python-gnupg passlib pyopenssl beautifulsoup4 smpplib flask-babel
34 ldap3 huey pyyaml qrcode oauth2client requests lxml cbor2 psycopg2
35 pydash ecdsa
36 ];
37
38 passthru.tests = { inherit (nixosTests) privacyidea; };
39
40 checkInputs = [ openssl mock pytestCheckHook responses testfixtures ];
41 disabledTests = [
42 "AESHardwareSecurityModuleTestCase"
43 "test_01_cert_request"
44 "test_01_loading_scripts"
45 "test_02_api_push_poll"
46 "test_02_cert_enrolled"
47 "test_02_enroll_rights"
48 "test_02_get_resolvers"
49 "test_02_success"
50 "test_03_get_identifiers"
51 "test_04_remote_user_auth"
52 "test_14_convert_timestamp_to_utc"
53 ];
54
55 pythonImportsCheck = [ "privacyidea" ];
56
57 postPatch = ''
58 substituteInPlace privacyidea/lib/resolvers/LDAPIdResolver.py --replace \
59 "/etc/privacyidea/ldap-ca.crt" \
60 "${cacert}/etc/ssl/certs/ca-bundle.crt"
61 '';
62
63 postInstall = ''
64 rm -rf $out/${python.sitePackages}/tests
65 '';
66
67 meta = with lib; {
68 description = "Multi factor authentication system (2FA, MFA, OTP Server)";
69 license = licenses.agpl3Plus;
70 homepage = "http://www.privacyidea.org";
71 maintainers = with maintainers; [ globin ma27 ];
72 };
73}