{ lib, python3, fetchFromGitHub, callPackage, writeText, fetchpatch, }: let frontend = callPackage ./frontend.nix {}; in python3.pkgs.buildPythonPackage rec { pname = "wger"; version = "unstable-2024-12-30"; pyproject = true; src = fetchFromGitHub { owner = "wger-project"; repo = "wger"; rev = "30871d621fa6e732f07bd33d4112b99539974e5f"; hash = "sha256-WcycWbzKug8vUfNnUDhvgmj1kUCpT1P1YJBfdIC1H9g="; }; build-system = [ python3.pkgs.hatchling ]; patches = [ ./patches/pyproject.patch ./patches/manage.patch ./patches/exercises-no-gifs.patch # adds support for proxy auth header (fetchpatch { url = "https://github.com/wger-project/wger/pull/1859/commits/d46d469fa802890d7162b07c098802810fc8417c.patch"; sha256 = "sha256-D+3FmiSokJe9iSJz7ZbRzS+kuP3yV64XhKnQ4Oh5x8c="; }) ]; # dependencies = with python3.pkgs; [ propagatedBuildInputs = with python3.pkgs; [ bleach celery django-crispy-bootstrap5 django # django-activity-stream (python3.pkgs.callPackage ./django-activity-stream.nix {}) django-axes django-compressor django-cors-headers django-crispy-forms # django-email-verification (python3.pkgs.callPackage ./django-email-verification.nix {}) django-environ django-filter django-formtools django-prometheus # django-recaptcha (python3.pkgs.callPackage ./django-recaptcha.nix {}) django-simple-history # django-sortedm2m (python3.pkgs.callPackage ./django-sortedm2m.nix {}) django-storages djangorestframework djangorestframework-simplejwt drf-spectacular easy-thumbnails flower fontawesomefree icalendar invoke # openfoodfacts (python3.pkgs.callPackage ./openfoodfacts.nix {}) pillow reportlab requests tqdm tzdata # extra?? redis django-redis drf-spectacular-sidecar (python3.pkgs.callPackage ./django-bootstrap-breadcrumbs.nix {}) psycopg2 ]; postPatch = '' cp manage.py wger/manage.py ''; # fixup compressed files postBuild = let staticSettings = writeText "static_settings.py" '' import os DEBUG = False STATIC_ROOT = os.environ["static"] COMPRESS_OFFLINE = True # So we don't need postgres dependencies DATABASES = {} ''; in '' # copy over static yarn things # cp -a ${frontend}/static/yarn $out/${python3.sitePackages}/wger/core/static cp -a ${frontend}/static/yarn wger/core/static python3 -m wger create-settings -s $PWD/tmp_settings.py cat ${staticSettings} >> $PWD/tmp_settings.py mkdir tmpstatic pushd tmpstatic static=. WGER_SETTINGS=../tmp_settings.py python3 ../manage.py collectstatic --no-input static=. WGER_SETTINGS=../tmp_settings.py python3 ../manage.py compress --force popd ''; postInstall = '' rm -rf $out/${python3.sitePackages}/wger/core/static cp -a tmpstatic $out/${python3.sitePackages}/wger/core/static mkdir $out/share cp -a $out/${python3.sitePackages}/wger/core/static $out/share ''; pythonImportsCheck = [ "wger" ]; meta = { description = ""; homepage = "https://github.com/wger-project/wger"; license = lib.licenses.agpl3Only; maintainers = with lib.maintainers; [ eyjhb ]; mainProgram = "wger"; }; }