diff --git a/pkgs/by-name/pr/pretix/package.nix b/pkgs/by-name/pr/pretix/package.nix index 4392def345c1..17283dbc80ae 100644 --- a/pkgs/by-name/pr/pretix/package.nix +++ b/pkgs/by-name/pr/pretix/package.nix @@ -1,11 +1,11 @@ { lib, - buildNpmPackage, fetchFromGitHub, - fetchpatch, fetchPypi, + fetchNpmDeps, libredirect, nodejs, + npmHooks, python3, gettext, nixosTests, @@ -19,7 +19,7 @@ let packageOverrides = self: super: { django = super.django_5; - django-oauth-toolkit = super.django-oauth-toolkit.overridePythonAttrs (oldAttrs: { + django-oauth-toolkit = super.django-oauth-toolkit.overridePythonAttrs (oldAttrs: rec { version = "2.3.0"; src = fetchFromGitHub { inherit (oldAttrs.src) owner repo; @@ -50,110 +50,56 @@ let pretix-plugin-build = self.callPackage ./plugin-build.nix { }; }; }; - + pythonPackages = python.pkgs; +in +pythonPackages.buildPythonApplication (finalAttrs: { pname = "pretix"; - version = "2026.4.2"; + version = "2026.5.0"; + pyproject = true; src = fetchFromGitHub { owner = "pretix"; repo = "pretix"; - tag = "v${version}"; - hash = "sha256-OECVdtPnr7qqLriPZWOyRm6ZqU8yO+SYzU69zaO+9rU="; + tag = "v${finalAttrs.version}"; + hash = "sha256-twXz3RaFujhZmARzZ5zIjGAwWchwhV8knq8Cr3h0Gjg="; }; - npmDeps = buildNpmPackage { - pname = "pretix-node-modules"; - inherit version src; - - sourceRoot = "${src.name}/src/pretix/static/npm_dir"; - npmDepsHash = "sha256-U4oXGir53h7R3z4p371PJGm2EU+arsqe/abn6GvSGXs="; - - dontBuild = true; - - installPhase = '' - runHook preInstall - - mkdir $out - cp -R node_modules $out/ - - runHook postInstall - ''; - }; -in -python.pkgs.buildPythonApplication rec { - inherit pname version src; - pyproject = true; - patches = [ - (fetchpatch { - url = "https://github.com/pretix/pretix/commit/d765a89139b2b28fa82145fb6f7e213ad46c086b.patch"; - hash = "sha256-we1TKu3mxsM3CEP5aCsdb3XGlYXbfa0hGWgjrljylKU="; - }) # Discover pretix.plugin entrypoints during build and add them into # INSTALLED_APPS, so that their static files are collected. ./plugin-build.patch ]; - pythonRelaxDeps = [ - "beautifulsoup4" - "bleach" - "celery" - "css-inline" - "cryptography" - "django-bootstrap3" - "django-compressor" - "django-filter" - "django-formset-js-improved" - "django-i18nfield" - "django-localflavor" - "django-phonenumber-field" - "dnspython" - "drf_ujson2" - "importlib_metadata" - "kombu" - "markdown" - "oauthlib" - "phonenumberslite" - "pillow" - "protobuf" - "pycparser" - "pycryptodome" - "pyjwt" - "pypdf" - "python-bidi" - "qrcode" - "redis" - "reportlab" - "requests" - "sentry-sdk" - "sepaxml" - "ua-parser" - "webauthn" - ]; - - pythonRemoveDeps = [ - "vat_moss_forked" # we provide a patched vat-moss package - ]; - postPatch = '' - NODE_PREFIX=src/pretix/static.dist/node_prefix - mkdir -p $NODE_PREFIX - cp -R ${npmDeps}/node_modules $NODE_PREFIX/ - chmod -R u+w $NODE_PREFIX/ - # unused sed -i "/setuptools-rust/d" pyproject.toml + # unbreak dependency relaxation substituteInPlace pyproject.toml \ --replace-fail '"backend"' '"setuptools.build_meta"' \ --replace-fail 'backend-path = ["_build"]' "" - # npm ci would remove and try to reinstall node_modules + # we take care of the npm build substituteInPlace src/pretix/_build.py \ - --replace-fail "npm ci" "npm install" + --replace-fail "npm ci" "true" \ + --replace-fail "npm run build" "true" ''; - build-system = with python.pkgs; [ + npmDeps = fetchNpmDeps { + inherit (finalAttrs) src; + hash = "sha256-Gkcz/QJCNuvhIdZnP/mPx5GD0EOJzxoP1dGI43pyOro="; + }; + + nativeBuildInputs = [ + nodejs + npmHooks.npmConfigHook + ]; + + preBuild = '' + npm run build + ''; + + build-system = with pythonPackages; [ gettext nodejs setuptools @@ -161,7 +107,7 @@ python.pkgs.buildPythonApplication rec { ]; dependencies = - with python.pkgs; + with pythonPackages; [ arabic-reshaper babel @@ -242,12 +188,53 @@ python.pkgs.buildPythonApplication rec { ++ django.optional-dependencies.argon2 ++ plugins; - optional-dependencies = with python.pkgs; { + optional-dependencies = with pythonPackages; { memcached = [ pylibmc ]; }; + pythonRelaxDeps = [ + "beautifulsoup4" + "bleach" + "celery" + "css-inline" + "cryptography" + "django-bootstrap3" + "django-compressor" + "django-filter" + "django-formset-js-improved" + "django-i18nfield" + "django-localflavor" + "django-phonenumber-field" + "dnspython" + "drf_ujson2" + "importlib_metadata" + "kombu" + "markdown" + "oauthlib" + "phonenumberslite" + "pillow" + "protobuf" + "pycparser" + "pycryptodome" + "pyjwt" + "pypdf" + "python-bidi" + "qrcode" + "redis" + "reportlab" + "requests" + "sentry-sdk" + "sepaxml" + "ua-parser" + "webauthn" + ]; + + pythonRemoveDeps = [ + "vat_moss_forked" # we provide a patched vat-moss package + ]; + postInstall = '' mkdir -p $out/bin cp ./src/manage.py $out/${python.sitePackages}/pretix/manage.py @@ -261,7 +248,7 @@ python.pkgs.buildPythonApplication rec { dontStrip = true; # no binaries nativeCheckInputs = - with python.pkgs; + with pythonPackages; [ libredirect.hook pytestCheckHook @@ -274,7 +261,7 @@ python.pkgs.buildPythonApplication rec { fakeredis responses ] - ++ lib.concatAttrValues optional-dependencies; + ++ lib.concatAttrValues finalAttrs.passthru.optional-dependencies; pytestFlags = [ "--reruns=3" @@ -285,6 +272,11 @@ python.pkgs.buildPythonApplication rec { "test_order_create_invoice" ]; + disabledTestPaths = [ + # too expensive + "src/tests/e2e" + ]; + preCheck = '' export PYTHONPATH=$(pwd)/src:$PYTHONPATH export DJANGO_SETTINGS_MODULE=tests.settings @@ -299,12 +291,11 @@ python.pkgs.buildPythonApplication rec { passthru = { inherit - npmDeps python ; plugins = lib.recurseIntoAttrs ( lib.packagesFromDirectoryRecursive { - inherit (python.pkgs) callPackage; + inherit (pythonPackages) callPackage; directory = ./plugins; } ); @@ -313,6 +304,8 @@ python.pkgs.buildPythonApplication rec { }; }; + __structuredAttrs = true; + meta = { description = "Ticketing software that cares about your event—all the way"; homepage = "https://github.com/pretix/pretix"; @@ -331,4 +324,4 @@ python.pkgs.buildPythonApplication rec { mainProgram = "pretix-manage"; platforms = lib.platforms.linux; }; -} +}) diff --git a/pkgs/by-name/pr/pretix/plugin-build.patch b/pkgs/by-name/pr/pretix/plugin-build.patch index aa935ed28148..f5b21018b33b 100644 --- a/pkgs/by-name/pr/pretix/plugin-build.patch +++ b/pkgs/by-name/pr/pretix/plugin-build.patch @@ -1,20 +1,12 @@ diff --git a/src/pretix/_build_settings.py b/src/pretix/_build_settings.py -index c03f56a1a..d1ea73b84 100644 +index 859a7f912..f717d76b4 100644 --- a/src/pretix/_build_settings.py +++ b/src/pretix/_build_settings.py -@@ -24,6 +24,8 @@ - This file contains settings that we need at wheel require time. All settings that we only need at runtime are set - in settings.py. - """ -+from importlib_metadata import entry_points -+ - from ._base_settings import * # NOQA - - ENTROPY = { -@@ -47,3 +49,6 @@ HAS_MEMCACHED = False - HAS_CELERY = False - HAS_GEOIP = False +@@ -49,3 +49,7 @@ HAS_GEOIP = False SENTRY_ENABLED = False + VITE_DEV_MODE = False + VITE_IGNORE = False + ++from importlib_metadata import entry_points +for entry_point in entry_points(group='pretix.plugin'): + INSTALLED_APPS.append(entry_point.module) # noqa: F405