Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 154 lines 3.3 kB view raw
1{ 2 lib, 3 python3, 4 fetchFromGitLab, 5 fetchpatch, 6 openldap, 7 nixosTests, 8}: 9 10let 11 python = python3; 12in 13python.pkgs.buildPythonApplication rec { 14 pname = "canaille"; 15 version = "0.0.74"; 16 pyproject = true; 17 18 disabled = python.pythonOlder "3.10"; 19 20 src = fetchFromGitLab { 21 owner = "yaal"; 22 repo = "canaille"; 23 rev = "refs/tags/${version}"; 24 hash = "sha256-FL02ADM7rUU43XR71UWr4FLr/NeUau7zRwTMOSFm1T4="; 25 }; 26 27 patches = [ 28 # https://gitlab.com/yaal/canaille/-/merge_requests/275 29 (fetchpatch { 30 url = "https://gitlab.com/yaal/canaille/-/commit/1c7fc8b1034a4423f7f46ad8adeced854910b702.patch"; 31 hash = "sha256-fu7D010NG7yUChOve7HY3e7mm2c/UGpfcTAiTU8BnGg="; 32 }) 33 ]; 34 35 build-system = with python.pkgs; [ 36 hatchling 37 babel 38 setuptools 39 ]; 40 41 dependencies = 42 with python.pkgs; 43 [ 44 blinker 45 flask 46 flask-caching 47 flask-wtf 48 pydantic-settings 49 httpx 50 wtforms 51 ] 52 ++ sentry-sdk.optional-dependencies.flask; 53 54 nativeCheckInputs = 55 with python.pkgs; 56 [ 57 pytestCheckHook 58 coverage 59 flask-webtest 60 pyquery 61 pytest-cov-stub 62 pytest-httpserver 63 pytest-lazy-fixtures 64 pytest-smtpd 65 pytest-xdist 66 scim2-tester 67 slapd 68 toml 69 faker 70 time-machine 71 pytest-scim2-server 72 ] 73 ++ optional-dependencies.front 74 ++ optional-dependencies.oidc 75 ++ optional-dependencies.scim 76 ++ optional-dependencies.ldap 77 ++ optional-dependencies.postgresql 78 ++ optional-dependencies.otp 79 ++ optional-dependencies.sms; 80 81 postInstall = '' 82 mkdir -p $out/etc/schema 83 cp $out/${python.sitePackages}/canaille/backends/ldap/schemas/* $out/etc/schema/ 84 ''; 85 86 preCheck = '' 87 # Needed by tests to setup a mockup ldap server. 88 export BIN="${openldap}/bin" 89 export SBIN="${openldap}/bin" 90 export SLAPD="${openldap}/libexec/slapd" 91 export SCHEMA="${openldap}/etc/schema" 92 93 # Just use their example config for testing 94 export CONFIG=tests/app/fixtures/default-config.toml 95 ''; 96 97 optional-dependencies = with python.pkgs; { 98 front = [ 99 email-validator 100 flask-babel 101 flask-talisman 102 flask-themer 103 pycountry 104 pytz 105 tomlkit 106 zxcvbn-rs-py 107 ]; 108 oidc = [ 109 authlib 110 joserfc 111 ]; 112 scim = [ 113 httpx 114 scim2-models 115 authlib 116 scim2-client 117 ]; 118 ldap = [ python-ldap ]; 119 sentry = [ sentry-sdk ]; 120 postgresql = [ 121 flask-alembic 122 passlib 123 sqlalchemy 124 sqlalchemy-json 125 sqlalchemy-utils 126 ] 127 ++ sqlalchemy.optional-dependencies.postgresql_psycopg2binary; 128 otp = [ 129 otpauth 130 pillow 131 qrcode 132 ]; 133 sms = [ smpplib ]; 134 server = [ hypercorn ]; 135 }; 136 137 passthru = { 138 inherit python; 139 tests = { 140 inherit (nixosTests) canaille; 141 }; 142 }; 143 144 meta = with lib; { 145 description = "Lightweight Identity and Authorization Management"; 146 homepage = "https://canaille.readthedocs.io/en/latest/index.html"; 147 changelog = "https://gitlab.com/yaal/canaille/-/blob/${src.rev}/CHANGES.rst"; 148 license = licenses.mit; 149 platforms = platforms.linux; 150 maintainers = with maintainers; [ erictapen ]; 151 mainProgram = "canaille"; 152 }; 153 154}