chromium,chromedriver: 129.0.6668.91 -> 129.0.6668.100
[NixPkgs.git] / pkgs / by-name / pr / pretix / package.nix
blobec6a4fc70f18098b5b1ae47ccb2184e5e53a93e2
1 { lib
2 , buildNpmPackage
3 , fetchFromGitHub
4 , fetchPypi
5 , nodejs
6 , python3
7 , gettext
8 , nixosTests
9 , plugins ? [ ]
12 let
13   python = python3.override {
14     self = python;
15     packageOverrides = self: super: {
16       bleach = super.bleach.overridePythonAttrs (oldAttrs: rec {
17         version = "5.0.1";
19         src = fetchPypi {
20           pname = "bleach";
21           inherit version;
22           hash = "sha256-DQMlXEfrm9Lyaqm7fyEHcy5+j+GVyi9kcJ/POwpKCFw=";
23         };
24       });
26       django = super.django_4;
28       django-oauth-toolkit = super.django-oauth-toolkit.overridePythonAttrs (oldAttrs: {
29         version = "2.3.0";
30         src = fetchFromGitHub {
31           inherit (oldAttrs.src) owner repo;
32           rev = "refs/tags/v${version}";
33           hash = "sha256-oGg5MD9p4PSUVkt5pGLwjAF4SHHf4Aqr+/3FsuFaybY=";
34         };
35       });
37       stripe = super.stripe.overridePythonAttrs rec {
38         version = "7.9.0";
40         src = fetchPypi {
41           pname = "stripe";
42           inherit version;
43           hash = "sha256-hOXkMINaSwzU/SpXzjhTJp0ds0OREc2mtu11LjSc9KE=";
44         };
45       };
47       pretix-plugin-build = self.callPackage ./plugin-build.nix { };
49       sentry-sdk = super.sentry-sdk_2;
50     };
51   };
53   pname = "pretix";
54   version = "2024.9.0";
56   src = fetchFromGitHub {
57     owner = "pretix";
58     repo = "pretix";
59     rev = "refs/tags/v${version}";
60     hash = "sha256-L6mTfLIx8kD/5s0Dfp24TEATmjxBXERQjynB0szH3DM=";
61   };
63   npmDeps = buildNpmPackage {
64     pname = "pretix-node-modules";
65     inherit version src;
67     sourceRoot = "${src.name}/src/pretix/static/npm_dir";
68     npmDepsHash = "sha256-zUui5tYINTDKA91WgRV51ilIPFBJpZ+S2fJwW85KJ9k=";
70     dontBuild = true;
72     installPhase = ''
73       runHook preInstall
75       mkdir $out
76       cp -R node_modules $out/
78       runHook postInstall
79     '';
80   };
82 python.pkgs.buildPythonApplication rec {
83   inherit pname version src;
84   pyproject = true;
86   patches = [
87     # Discover pretix.plugin entrypoints during build and add them into
88     # INSTALLED_APPS, so that their static files are collected.
89     ./plugin-build.patch
90   ];
92   pythonRelaxDeps = [
93     "django-phonenumber-field"
94     "importlib-metadata"
95     "kombu"
96     "markdown"
97     "pillow"
98     "protobuf"
99     "pyjwt"
100     "python-bidi"
101     "requests"
102     "sentry-sdk"
103   ];
105   pythonRemoveDeps = [
106     "vat-moss-forked" # we provide a patched vat-moss package
107   ];
109   postPatch = ''
110     NODE_PREFIX=src/pretix/static.dist/node_prefix
111     mkdir -p $NODE_PREFIX
112     cp -R ${npmDeps}/node_modules $NODE_PREFIX/
113     chmod -R u+w $NODE_PREFIX/
115     # unused
116     sed -i "/setuptools-rust/d" pyproject.toml
118     substituteInPlace pyproject.toml \
119       --replace-fail '"backend"' '"setuptools.build_meta"' \
120       --replace-fail 'backend-path = ["_build"]' ""
121   '';
123   build-system = with python.pkgs; [
124     gettext
125     nodejs
126     setuptools
127     tomli
128   ];
130   dependencies = with python.pkgs; [
131     arabic-reshaper
132     babel
133     beautifulsoup4
134     bleach
135     celery
136     chardet
137     cryptography
138     css-inline
139     defusedcsv
140     django
141     django-bootstrap3
142     django-compressor
143     django-countries
144     django-filter
145     django-formset-js-improved
146     django-formtools
147     django-hierarkey
148     django-hijack
149     django-i18nfield
150     django-libsass
151     django-localflavor
152     django-markup
153     django-oauth-toolkit
154     django-otp
155     django-phonenumber-field
156     django-redis
157     django-scopes
158     django-statici18n
159     djangorestframework
160     dnspython
161     drf-ujson2
162     geoip2
163     importlib-metadata
164     isoweek
165     jsonschema
166     kombu
167     libsass
168     lxml
169     markdown
170     mt-940
171     oauthlib
172     openpyxl
173     packaging
174     paypalrestsdk
175     paypal-checkout-serversdk
176     pyjwt
177     phonenumberslite
178     pillow
179     pretix-plugin-build
180     protobuf
181     psycopg2-binary
182     pycountry
183     pycparser
184     pycryptodome
185     pypdf
186     python-bidi
187     python-dateutil
188     pytz
189     pytz-deprecation-shim
190     pyuca
191     qrcode
192     redis
193     reportlab
194     requests
195     sentry-sdk
196     sepaxml
197     slimit
198     stripe
199     text-unidecode
200     tlds
201     tqdm
202     ua-parser
203     vat-moss
204     vobject
205     webauthn
206     zeep
207   ]
208   ++ django.optional-dependencies.argon2
209   ++ plugins;
211   optional-dependencies = with python.pkgs; {
212     memcached = [
213       pylibmc
214     ];
215   };
217   postInstall = ''
218     mkdir -p $out/bin
219     cp ./src/manage.py $out/bin/pretix-manage
221     # Trim packages size
222     rm -rfv $out/${python.sitePackages}/pretix/static.dist/node_prefix
223   '';
225   dontStrip = true; # no binaries
227   nativeCheckInputs = with python.pkgs; [
228     pytestCheckHook
229     pytest-xdist
230     pytest-mock
231     pytest-django
232     pytest-asyncio
233     pytest-rerunfailures
234     freezegun
235     fakeredis
236     responses
237   ] ++ lib.flatten (lib.attrValues optional-dependencies);
239   pytestFlagsArray = [
240     "--reruns" "3"
241   ];
243   disabledTests = [
244     # unreliable around day changes
245     "test_order_create_invoice"
247     # outdated translation files
248     # https://github.com/pretix/pretix/commit/c4db2a48b6ac81763fa67475d8182aee41c31376
249     "test_different_dates_spanish"
250     "test_same_day_spanish"
251     "test_same_month_spanish"
252     "test_same_year_spanish"
253   ];
255   preCheck = ''
256     export PYTHONPATH=$(pwd)/src:$PYTHONPATH
257     export DJANGO_SETTINGS_MODULE=tests.settings
258   '';
260   passthru = {
261     inherit
262       npmDeps
263       python
264     ;
265     plugins = lib.recurseIntoAttrs
266       (python.pkgs.callPackage ./plugins {
267         inherit (python.pkgs) callPackage;
268       }
269     );
270     tests = {
271       inherit (nixosTests) pretix;
272     };
273   };
275   meta = with lib; {
276     description = "Ticketing software that cares about your event—all the way";
277     homepage = "https://github.com/pretix/pretix";
278     license = with licenses; [
279       agpl3Only
280       # 3rd party components below src/pretix/static
281       bsd2
282       isc
283       mit
284       ofl # fontawesome
285       unlicense
286       # all other files below src/pretix/static and src/pretix/locale and aux scripts
287       asl20
288     ];
289     maintainers = with maintainers; [ hexa ];
290     mainProgram = "pretix-manage";
291     platforms = platforms.linux;
292   };