2024-12-03 07:45:11 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
python3,
|
|
|
|
fetchFromGitHub,
|
|
|
|
callPackage,
|
2024-12-05 16:02:18 +00:00
|
|
|
writeText,
|
2025-01-02 16:21:21 +00:00
|
|
|
fetchpatch,
|
2024-12-03 07:45:11 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
frontend = callPackage ./frontend.nix {};
|
2024-12-05 18:30:01 +00:00
|
|
|
in python3.pkgs.buildPythonPackage rec {
|
2024-12-03 07:45:11 +00:00
|
|
|
pname = "wger";
|
2025-01-02 16:21:21 +00:00
|
|
|
version = "unstable-2024-12-30";
|
2024-12-03 07:45:11 +00:00
|
|
|
pyproject = true;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "wger-project";
|
|
|
|
repo = "wger";
|
2025-01-02 16:21:21 +00:00
|
|
|
rev = "30871d621fa6e732f07bd33d4112b99539974e5f";
|
|
|
|
hash = "sha256-WcycWbzKug8vUfNnUDhvgmj1kUCpT1P1YJBfdIC1H9g=";
|
2024-12-03 07:45:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
build-system = [
|
|
|
|
python3.pkgs.hatchling
|
|
|
|
];
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
./patches/pyproject.patch
|
|
|
|
./patches/manage.patch
|
2024-12-05 18:30:01 +00:00
|
|
|
./patches/exercises-no-gifs.patch
|
2025-01-02 16:21:21 +00:00
|
|
|
|
|
|
|
# adds support for proxy auth header
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/wger-project/wger/pull/1859/commits/d46d469fa802890d7162b07c098802810fc8417c.patch";
|
|
|
|
sha256 = "sha256-D+3FmiSokJe9iSJz7ZbRzS+kuP3yV64XhKnQ4Oh5x8c=";
|
|
|
|
})
|
2024-12-03 07:45:11 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
# 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??
|
2024-12-06 17:43:05 +00:00
|
|
|
redis
|
|
|
|
django-redis
|
2024-12-03 07:45:11 +00:00
|
|
|
drf-spectacular-sidecar
|
|
|
|
(python3.pkgs.callPackage ./django-bootstrap-breadcrumbs.nix {})
|
|
|
|
psycopg2
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
cp manage.py wger/manage.py
|
|
|
|
'';
|
|
|
|
|
2024-12-05 16:02:18 +00:00
|
|
|
# fixup compressed files
|
|
|
|
postBuild = let
|
|
|
|
staticSettings = writeText "static_settings.py" ''
|
2025-01-02 16:21:21 +00:00
|
|
|
import os
|
|
|
|
|
2024-12-05 16:02:18 +00:00
|
|
|
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
|
|
|
|
|
2025-01-02 16:21:21 +00:00
|
|
|
python3 -m wger create-settings -s $PWD/tmp_settings.py
|
2024-12-05 16:02:18 +00:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2024-12-03 07:45:11 +00:00
|
|
|
postInstall = ''
|
2024-12-05 16:02:18 +00:00
|
|
|
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
|
2024-12-03 07:45:11 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"wger"
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "";
|
|
|
|
homepage = "https://github.com/wger-project/wger";
|
|
|
|
license = lib.licenses.agpl3Only;
|
|
|
|
maintainers = with lib.maintainers; [ eyjhb ];
|
|
|
|
mainProgram = "wger";
|
|
|
|
};
|
|
|
|
}
|