services.wger: updated to newest version + added auth proxy header

This commit is contained in:
eyjhb 2025-01-02 17:21:21 +01:00
parent 5c65f7f922
commit 94e08fd2f0
No known key found for this signature in database
GPG key ID: 609F508E3239F920
3 changed files with 19 additions and 46 deletions

View file

@ -4,20 +4,21 @@
fetchFromGitHub, fetchFromGitHub,
callPackage, callPackage,
writeText, writeText,
fetchpatch,
}: }:
let let
frontend = callPackage ./frontend.nix {}; frontend = callPackage ./frontend.nix {};
in python3.pkgs.buildPythonPackage rec { in python3.pkgs.buildPythonPackage rec {
pname = "wger"; pname = "wger";
version = "unstable-2024-12-01"; version = "unstable-2024-12-30";
pyproject = true; pyproject = true;
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "wger-project"; owner = "wger-project";
repo = "wger"; repo = "wger";
rev = "bfca74e88f6c9ff6e917e0ba0e8e9c782ae0047b"; rev = "30871d621fa6e732f07bd33d4112b99539974e5f";
hash = "sha256-VuVKgkNp6Omiag72lOn6p51kC/jvApX/kRAPpK95U7w="; hash = "sha256-WcycWbzKug8vUfNnUDhvgmj1kUCpT1P1YJBfdIC1H9g=";
}; };
build-system = [ build-system = [
@ -26,9 +27,14 @@ in python3.pkgs.buildPythonPackage rec {
patches = [ patches = [
./patches/pyproject.patch ./patches/pyproject.patch
./patches/tasks.patch
./patches/manage.patch ./patches/manage.patch
./patches/exercises-no-gifs.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; [ # dependencies = with python3.pkgs; [
@ -86,6 +92,8 @@ in python3.pkgs.buildPythonPackage rec {
# fixup compressed files # fixup compressed files
postBuild = let postBuild = let
staticSettings = writeText "static_settings.py" '' staticSettings = writeText "static_settings.py" ''
import os
DEBUG = False DEBUG = False
STATIC_ROOT = os.environ["static"] STATIC_ROOT = os.environ["static"]
COMPRESS_OFFLINE = True COMPRESS_OFFLINE = True
@ -97,7 +105,7 @@ in python3.pkgs.buildPythonPackage rec {
# cp -a ${frontend}/static/yarn $out/${python3.sitePackages}/wger/core/static # cp -a ${frontend}/static/yarn $out/${python3.sitePackages}/wger/core/static
cp -a ${frontend}/static/yarn wger/core/static cp -a ${frontend}/static/yarn wger/core/static
python3 -m wger.tasks create-settings -s $PWD/tmp_settings.py python3 -m wger create-settings -s $PWD/tmp_settings.py
cat ${staticSettings} >> $PWD/tmp_settings.py cat ${staticSettings} >> $PWD/tmp_settings.py
mkdir tmpstatic mkdir tmpstatic
pushd tmpstatic pushd tmpstatic

View file

@ -138,15 +138,15 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
services.wger.wgerSettings = { services.wger.wgerSettings = {
EMAIL_FROM = mkDefault "wger Workout Manager <wger@example.com>"; EMAIL_FROM = mkDefault "wger Workout Manager <wger@example.com>";
ALLOW_REGISTRATION = true; ALLOW_REGISTRATION = mkDefault true;
ALLOW_GUEST_USERS = true; ALLOW_GUEST_USERS = mkDefault true;
ALLOW_UPLOAD_VIDEOS = false; ALLOW_UPLOAD_VIDEOS = mkDefault false;
MIN_ACCOUNT_AGE_TO_TRUST = 1; MIN_ACCOUNT_AGE_TO_TRUST = mkDefault 1;
EXERCISE_CACHE_TTL = 3600; # 1 hour EXERCISE_CACHE_TTL = mkDefault 3600; # 1 hour
}; };
services.wger.djangoSettings = rec { services.wger.djangoSettings = rec {
DEBUG = false; DEBUG = mkDefault false;
# configure database as postgresql or sqlite # configure database as postgresql or sqlite
DATABASES.default = if cfg.configurePostgres then { DATABASES.default = if cfg.configurePostgres then {

View file

@ -1,35 +0,0 @@
diff --git a/wger/tasks.py b/wger/tasks.py
index b1b4b7c65..50bf95b7c 100644
--- a/wger/tasks.py
+++ b/wger/tasks.py
@@ -31,7 +31,7 @@ from django.utils.crypto import get_random_string
# Third Party
import requests
-from invoke import task
+from invoke import task, Program, Collection
from tqdm import tqdm
@@ -358,3 +358,20 @@ def database_exists():
sys.exit(0)
else:
return True
+
+def main():
+ ns = Collection(
+ start,
+ bootstrap,
+ create_settings,
+ create_or_reset_admin,
+ migrate_db,
+ load_fixtures,
+ load_online_fixtures,
+ )
+ program = Program(namespace=ns)
+ program.run()
+
+
+if __name__ == "__main__":
+ main()