From 94e08fd2f0675f5ca154164db1a4bb3e938ecb58 Mon Sep 17 00:00:00 2001 From: eyjhb Date: Thu, 2 Jan 2025 17:21:21 +0100 Subject: [PATCH] services.wger: updated to newest version + added auth proxy header --- .../gerd/services/wger/wgerpkg/default.nix | 18 +++++++--- .../gerd/services/wger/wgerpkg/module.nix | 12 +++---- .../services/wger/wgerpkg/patches/tasks.patch | 35 ------------------- 3 files changed, 19 insertions(+), 46 deletions(-) delete mode 100644 machines/gerd/services/wger/wgerpkg/patches/tasks.patch diff --git a/machines/gerd/services/wger/wgerpkg/default.nix b/machines/gerd/services/wger/wgerpkg/default.nix index d774d1e..2fa921f 100644 --- a/machines/gerd/services/wger/wgerpkg/default.nix +++ b/machines/gerd/services/wger/wgerpkg/default.nix @@ -4,20 +4,21 @@ fetchFromGitHub, callPackage, writeText, + fetchpatch, }: let frontend = callPackage ./frontend.nix {}; in python3.pkgs.buildPythonPackage rec { pname = "wger"; - version = "unstable-2024-12-01"; + version = "unstable-2024-12-30"; pyproject = true; src = fetchFromGitHub { owner = "wger-project"; repo = "wger"; - rev = "bfca74e88f6c9ff6e917e0ba0e8e9c782ae0047b"; - hash = "sha256-VuVKgkNp6Omiag72lOn6p51kC/jvApX/kRAPpK95U7w="; + rev = "30871d621fa6e732f07bd33d4112b99539974e5f"; + hash = "sha256-WcycWbzKug8vUfNnUDhvgmj1kUCpT1P1YJBfdIC1H9g="; }; build-system = [ @@ -26,9 +27,14 @@ in python3.pkgs.buildPythonPackage rec { patches = [ ./patches/pyproject.patch - ./patches/tasks.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; [ @@ -86,6 +92,8 @@ in python3.pkgs.buildPythonPackage rec { # fixup compressed files postBuild = let staticSettings = writeText "static_settings.py" '' + import os + DEBUG = False STATIC_ROOT = os.environ["static"] 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 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 mkdir tmpstatic pushd tmpstatic diff --git a/machines/gerd/services/wger/wgerpkg/module.nix b/machines/gerd/services/wger/wgerpkg/module.nix index 9b72ed9..4f69f3c 100644 --- a/machines/gerd/services/wger/wgerpkg/module.nix +++ b/machines/gerd/services/wger/wgerpkg/module.nix @@ -138,15 +138,15 @@ in config = mkIf cfg.enable { services.wger.wgerSettings = { EMAIL_FROM = mkDefault "wger Workout Manager "; - ALLOW_REGISTRATION = true; - ALLOW_GUEST_USERS = true; - ALLOW_UPLOAD_VIDEOS = false; - MIN_ACCOUNT_AGE_TO_TRUST = 1; - EXERCISE_CACHE_TTL = 3600; # 1 hour + ALLOW_REGISTRATION = mkDefault true; + ALLOW_GUEST_USERS = mkDefault true; + ALLOW_UPLOAD_VIDEOS = mkDefault false; + MIN_ACCOUNT_AGE_TO_TRUST = mkDefault 1; + EXERCISE_CACHE_TTL = mkDefault 3600; # 1 hour }; services.wger.djangoSettings = rec { - DEBUG = false; + DEBUG = mkDefault false; # configure database as postgresql or sqlite DATABASES.default = if cfg.configurePostgres then { diff --git a/machines/gerd/services/wger/wgerpkg/patches/tasks.patch b/machines/gerd/services/wger/wgerpkg/patches/tasks.patch deleted file mode 100644 index 2f8d150..0000000 --- a/machines/gerd/services/wger/wgerpkg/patches/tasks.patch +++ /dev/null @@ -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() -