Compare commits
5 commits
878c83a8eb
...
4fd55efab9
Author | SHA1 | Date | |
---|---|---|---|
|
4fd55efab9 | ||
|
efb5711551 | ||
|
96e004a541 | ||
|
2f2993ac16 | ||
|
80ef4fabc8 |
19 changed files with 760 additions and 17 deletions
|
@ -19,11 +19,19 @@
|
|||
./gerd/services/cyberchef.nix
|
||||
./gerd/services/nextcloud.nix
|
||||
./gerd/services/stalwart
|
||||
./gerd/services/wger
|
||||
|
||||
./gerd/services/element.nix
|
||||
./gerd/services/matrix-synapse.nix
|
||||
];
|
||||
|
||||
# TODO: place this a better place
|
||||
zramSwap = {
|
||||
enable = true;
|
||||
memoryPercent = 75;
|
||||
algorithm = "lz4";
|
||||
};
|
||||
|
||||
networking.hostName = "gerd";
|
||||
networking.hostId = "e1166ac9";
|
||||
|
||||
|
@ -37,6 +45,7 @@
|
|||
"safe/svcs/nextcloud" = { mountpoint = "/srv/nextcloud"; extra.options.quota = "5G"; };
|
||||
"safe/svcs/stalwart" = { mountpoint = "/srv/stalwart"; extra.options.quota = "5G"; };
|
||||
"safe/svcs/synapse" = { mountpoint = "/srv/synapse"; extra.options.quota = "5G"; };
|
||||
"safe/svcs/wger" = { mountpoint = "/srv/wger"; extra.options.quota = "5G"; };
|
||||
"safe/svcs/postgresql" = { mountpoint = "/srv/postgresql"; extra.options.quota = "5G"; };
|
||||
"backup/postgresql" = { mountpoint = "/media/backup/postgresqlbackup"; extra.options.quota = "5G"; };
|
||||
};
|
||||
|
|
|
@ -76,6 +76,9 @@ let
|
|||
error_page 401 =302 https://${config.mine.shared.settings.authelia.domain}/?rd=$target_url;
|
||||
'';
|
||||
in {
|
||||
# TODO: fix this
|
||||
mine.shared.lib.authelia.autheliaLocation = autheliaLocation;
|
||||
|
||||
mine.shared.lib.authelia.mkProtectedWebsite = { vhostConfig, endpoint ? "/" }: lib.recursiveUpdate vhostConfig {
|
||||
extraConfig = (lib.attrByPath [ "extraConfig" ] "" vhostConfig) + "\n" + "include ${autheliaLocation};";
|
||||
locations."${endpoint}" = config.mine.shared.lib.authelia.mkProtectedLocation (lib.attrByPath [ "locations" endpoint ] {} vhostConfig);
|
||||
|
|
149
machines/gerd/services/wger/default.nix
Normal file
149
machines/gerd/services/wger/default.nix
Normal file
|
@ -0,0 +1,149 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
svc_domain = "wger.${config.mine.shared.settings.domain}";
|
||||
port = 8000;
|
||||
wger_user = "wger";
|
||||
statedir = config.mine.zfsMounts."rpool/safe/svcs/wger";
|
||||
|
||||
wgerpkgs = pkgs.callPackage ./wgerpkg/default.nix {};
|
||||
|
||||
# # Application settings
|
||||
# WGER_SETTINGS['EMAIL_FROM'] = 'wger Workout Manager <wger@example.com>'
|
||||
# WGER_SETTINGS["ALLOW_REGISTRATION"] = True
|
||||
# WGER_SETTINGS["ALLOW_GUEST_USERS"] = True
|
||||
# WGER_SETTINGS["ALLOW_UPLOAD_VIDEOS"] = False
|
||||
# WGER_SETTINGS["MIN_ACCOUNT_AGE_TO_TRUST"] = 21 # in days
|
||||
# WGER_SETTINGS["EXERCISE_CACHE_TTL"] = 3600 # in seconds
|
||||
wger_settings = {
|
||||
EMAIL_FROM = "wger Workout Manager <wger@example.com>";
|
||||
ALLOW_REGISTRATION = true;
|
||||
ALLOW_GUEST_USERS = true;
|
||||
ALLOW_UPLOAD_VIDEOS = false;
|
||||
MIN_ACCOUNT_AGE_TO_TRUST = 21;
|
||||
EXERCISE_CACHE_TTL = 3600;
|
||||
};
|
||||
|
||||
django_settings = rec {
|
||||
DEBUG = true;
|
||||
DATABASES.default = {
|
||||
# ENGINE = "django.db.backends.sqlite3";
|
||||
# NAME = "${statedir}/database.sqlite";
|
||||
# USER = "";
|
||||
# PASSWORD = "";
|
||||
# HOST = "";
|
||||
# PORT = "";
|
||||
ENGINE = "django.db.backends.postgresql";
|
||||
NAME = "wger";
|
||||
USER = "wger";
|
||||
PASSWORD = "";
|
||||
HOST = "/run/postgresql";
|
||||
PORT = "";
|
||||
};
|
||||
|
||||
ADMINS = [["Your Name" "test@test.dk"]];
|
||||
MANAGERS = ADMINS;
|
||||
|
||||
TIME_ZONE = "Europe/Berlin";
|
||||
|
||||
SECRET_KEY = "2w!yl6ausb-$05#mjnec)g_h#nc9pzzw0c(kvaskocvyyg1oqc";
|
||||
|
||||
SITE_URL = "http://localhost:8100";
|
||||
|
||||
MEDIA_ROOT = "${statedir}/media";
|
||||
MEDIA_URL = "/media/";
|
||||
|
||||
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend";
|
||||
|
||||
# DEFAULT_FROM_EMAIL = WGER_SETTINGS['EMAIL_FROM']
|
||||
|
||||
EMAIL_PAGE_DOMAIN = SITE_URL;
|
||||
|
||||
CSRF_TRUSTED_ORIGINS = [ "https://${svc_domain}" ];
|
||||
ALLOWED_HOSTS = [ svc_domain ];
|
||||
|
||||
RECAPTCHA_PUBLIC_KEY = "";
|
||||
RECAPTCHA_PRIVATE_KEY = "";
|
||||
USE_RECAPTCHA = false;
|
||||
|
||||
};
|
||||
|
||||
wger_settings_file = pkgs.writeText "settings.json" (builtins.toJSON wger_settings);
|
||||
django_settings_file = pkgs.writeText "settings.json" (builtins.toJSON django_settings);
|
||||
settingsFile = pkgs.writeText "settings.py" ''
|
||||
from wger.settings_global import *
|
||||
import json
|
||||
|
||||
with open("${django_settings_file}") as f:
|
||||
globals().update(json.load(f))
|
||||
|
||||
with open("${wger_settings_file}") as f:
|
||||
WGER_SETTINGS.update(json.load(f))
|
||||
'';
|
||||
in {
|
||||
|
||||
systemd.services.wger = {
|
||||
description = "wger fitness";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "networking.target" ];
|
||||
script = ''
|
||||
# general wger things
|
||||
${wgerpkgs}/bin/wger migrate-db -s ${settingsFile} || true
|
||||
# ${wgerpkgs}/bin/wger load-fixtures -s ${settingsFile} || true
|
||||
# ${wgerpkgs}/bin/wger load-online-fixtures -s ${settingsFile} || true
|
||||
|
||||
# manage things
|
||||
# WGER_SETTINGS=${settingsFile} ${wgerpkgs}/bin/manage download-exercise-images || true
|
||||
# WGER_SETTINGS=${settingsFile} ${wgerpkgs}/bin/manage download-exercise-videos || true
|
||||
# WGER_SETTINGS=${settingsFile} ${wgerpkgs}/bin/manage download-ingredient-images || true
|
||||
WGER_SETTINGS=${settingsFile} ${wgerpkgs}/bin/manage sync-exercises || true
|
||||
# WGER_SETTINGS=${settingsFile} ${wgerpkgs}/bin/manage sync-ingredients || true
|
||||
WGER_SETTINGS=${settingsFile} ${wgerpkgs}/bin/manage exercises-health-check || true
|
||||
|
||||
# run server
|
||||
${wgerpkgs}/bin/wger start -s ${settingsFile}
|
||||
'';
|
||||
|
||||
serviceConfig = {
|
||||
User = "wger";
|
||||
Group = "wger";
|
||||
|
||||
};
|
||||
};
|
||||
users.users."${wger_user}"= {
|
||||
uid = 738;
|
||||
isSystemUser = true;
|
||||
group = wger_user;
|
||||
|
||||
};
|
||||
users.groups."${wger_user}".gid = 738;
|
||||
|
||||
services.postgresql = {
|
||||
ensureDatabases = [ wger_user ];
|
||||
ensureUsers = [{
|
||||
name = wger_user;
|
||||
ensureDBOwnership = true;
|
||||
}];
|
||||
};
|
||||
|
||||
|
||||
services.nginx.virtualHosts."${svc_domain}" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
|
||||
extraConfig = ''
|
||||
include ${config.mine.shared.lib.authelia.autheliaLocation};
|
||||
'';
|
||||
|
||||
locations."/" = config.mine.shared.lib.authelia.mkProtectedLocation {
|
||||
proxyPass = "http://localhost:${builtins.toString port}";
|
||||
};
|
||||
locations."/api/v2/register" = config.mine.shared.lib.authelia.mkProtectedLocation {
|
||||
proxyPass = "http://localhost:${builtins.toString port}";
|
||||
};
|
||||
|
||||
locations."/static".proxyPass = "http://localhost:${builtins.toString port}";
|
||||
locations."/media".proxyPass = "http://localhost:${builtins.toString port}";
|
||||
locations."/api".proxyPass = "http://localhost:${builtins.toString port}";
|
||||
};
|
||||
}
|
1
machines/gerd/services/wger/wgerpkg/.#settings.nix
Symbolic link
1
machines/gerd/services/wger/wgerpkg/.#settings.nix
Symbolic link
|
@ -0,0 +1 @@
|
|||
eyjhb@chronos.625709:1733150131
|
1
machines/gerd/services/wger/wgerpkg/.#settings.py
Symbolic link
1
machines/gerd/services/wger/wgerpkg/.#settings.py
Symbolic link
|
@ -0,0 +1 @@
|
|||
eyjhb@chronos.625709:1733150131
|
97
machines/gerd/services/wger/wgerpkg/default.nix
Normal file
97
machines/gerd/services/wger/wgerpkg/default.nix
Normal file
|
@ -0,0 +1,97 @@
|
|||
{
|
||||
lib,
|
||||
python3,
|
||||
fetchFromGitHub,
|
||||
callPackage,
|
||||
}:
|
||||
|
||||
let
|
||||
frontend = callPackage ./frontend.nix {};
|
||||
in python3.pkgs.buildPythonApplication rec {
|
||||
pname = "wger";
|
||||
version = "unstable";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "wger-project";
|
||||
repo = "wger";
|
||||
rev = "bfca74e88f6c9ff6e917e0ba0e8e9c782ae0047b";
|
||||
hash = "sha256-VuVKgkNp6Omiag72lOn6p51kC/jvApX/kRAPpK95U7w=";
|
||||
};
|
||||
|
||||
build-system = [
|
||||
python3.pkgs.hatchling
|
||||
];
|
||||
|
||||
patches = [
|
||||
./patches/pyproject.patch
|
||||
./patches/tasks.patch
|
||||
./patches/manage.patch
|
||||
];
|
||||
|
||||
# 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??
|
||||
drf-spectacular-sidecar
|
||||
(python3.pkgs.callPackage ./django-bootstrap-breadcrumbs.nix {})
|
||||
psycopg2
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
cp manage.py wger/manage.py
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
cp -a ${frontend}/static/yarn $out/${python3.sitePackages}/wger/core/static
|
||||
'';
|
||||
|
||||
pythonImportsCheck = [
|
||||
"wger"
|
||||
];
|
||||
|
||||
meta = {
|
||||
description = "";
|
||||
homepage = "https://github.com/wger-project/wger";
|
||||
license = lib.licenses.agpl3Only;
|
||||
maintainers = with lib.maintainers; [ eyjhb ];
|
||||
mainProgram = "wger";
|
||||
};
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
lib,
|
||||
buildPythonPackage,
|
||||
fetchFromGitHub,
|
||||
setuptools,
|
||||
wheel,
|
||||
django,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "django-activity-stream";
|
||||
version = "2.0.0";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "justquick";
|
||||
repo = "django-activity-stream";
|
||||
rev = version;
|
||||
hash = "sha256-fZrZDCWBFx1R9GGcTkjos7blSBNx1JTdTIVLKz+E2+c=";
|
||||
};
|
||||
|
||||
build-system = [
|
||||
setuptools
|
||||
wheel
|
||||
];
|
||||
|
||||
dependencies = [
|
||||
django
|
||||
];
|
||||
|
||||
pythonImportsCheck = [
|
||||
# "django_activity_stream"
|
||||
"actstream"
|
||||
];
|
||||
|
||||
meta = {
|
||||
description = "Generate generic activity streams from the actions on your site. Users can follow any actors' activities for personalized streams";
|
||||
homepage = "https://github.com/justquick/django-activity-stream";
|
||||
changelog = "https://github.com/justquick/django-activity-stream/blob/${src.rev}/CHANGELOG.rst";
|
||||
license = lib.licenses.bsd3;
|
||||
maintainers = with lib.maintainers; [ ];
|
||||
};
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
lib,
|
||||
buildPythonPackage,
|
||||
fetchFromGitHub,
|
||||
setuptools,
|
||||
wheel,
|
||||
django,
|
||||
six,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "bootstrap-breadcrumbs";
|
||||
version = "0.9.2";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "prymitive";
|
||||
repo = "bootstrap-breadcrumbs";
|
||||
rev = version;
|
||||
hash = "sha256-w6s3LL/skzz4EnWtdsa5GXeISrJzr4yQ8hm/gQMva1o=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
./patches/breadcrumbs.patch
|
||||
];
|
||||
|
||||
build-system = [
|
||||
setuptools
|
||||
wheel
|
||||
];
|
||||
|
||||
dependencies = [
|
||||
django
|
||||
six
|
||||
];
|
||||
|
||||
pythonImportsCheck = [
|
||||
# "bootstrap_breadcrumbs"
|
||||
];
|
||||
|
||||
meta = {
|
||||
description = "Django template tags for easy breadcrumbs using twitter bootstrap css classes or custom template";
|
||||
homepage = "https://github.com/prymitive/bootstrap-breadcrumbs";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ ];
|
||||
};
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
{
|
||||
lib,
|
||||
buildPythonPackage,
|
||||
fetchFromGitHub,
|
||||
setuptools,
|
||||
wheel,
|
||||
asgiref,
|
||||
coverage,
|
||||
deprecation,
|
||||
django,
|
||||
iniconfig,
|
||||
packaging,
|
||||
pluggy,
|
||||
pyjwt,
|
||||
pytest,
|
||||
pytest-django,
|
||||
sqlparse,
|
||||
validators,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "django-email-verification";
|
||||
version = "unstable-2024-07-12";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "LeoneBacciu";
|
||||
repo = "django-email-verification";
|
||||
rev = "49e841b96e8bd39f0ad359a75be4711508ac4879";
|
||||
hash = "sha256-4hMSA1d6GOu7Xo7Qq1tBob4lW2zq1E4YaD8w0BnFfVc=";
|
||||
};
|
||||
|
||||
build-system = [
|
||||
setuptools
|
||||
wheel
|
||||
];
|
||||
|
||||
dependencies = [
|
||||
asgiref
|
||||
coverage
|
||||
deprecation
|
||||
django
|
||||
iniconfig
|
||||
packaging
|
||||
pluggy
|
||||
pyjwt
|
||||
pytest
|
||||
pytest-django
|
||||
sqlparse
|
||||
validators
|
||||
];
|
||||
|
||||
pythonImportsCheck = [
|
||||
# "django_email_verification"
|
||||
];
|
||||
|
||||
meta = {
|
||||
description = "A Django app that takes care of verifying a users's email address and activating their profile";
|
||||
homepage = "https://github.com/LeoneBacciu/django-email-verification";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ ];
|
||||
};
|
||||
}
|
46
machines/gerd/services/wger/wgerpkg/django-recaptcha.nix
Normal file
46
machines/gerd/services/wger/wgerpkg/django-recaptcha.nix
Normal file
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
lib,
|
||||
buildPythonPackage,
|
||||
fetchFromGitHub,
|
||||
setuptools,
|
||||
wheel,
|
||||
django,
|
||||
coveralls,
|
||||
tox,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "django-recaptcha";
|
||||
version = "4.0.0";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "django-recaptcha";
|
||||
repo = "django-recaptcha";
|
||||
rev = version;
|
||||
hash = "sha256-B6Z9oKcMjSh+zE28k0ipoBppm9dD+Moa+PAZqXVabpA=";
|
||||
};
|
||||
|
||||
build-system = [
|
||||
setuptools
|
||||
wheel
|
||||
];
|
||||
|
||||
dependencies = [
|
||||
django
|
||||
coveralls
|
||||
tox
|
||||
];
|
||||
|
||||
pythonImportsCheck = [
|
||||
# "django_recaptcha"
|
||||
];
|
||||
|
||||
meta = {
|
||||
description = "Django reCAPTCHA form field/widget integration app";
|
||||
homepage = "https://github.com/django-recaptcha/django-recaptcha";
|
||||
changelog = "https://github.com/django-recaptcha/django-recaptcha/blob/${src.rev}/CHANGELOG.md";
|
||||
license = lib.licenses.bsd3;
|
||||
maintainers = with lib.maintainers; [ ];
|
||||
};
|
||||
}
|
49
machines/gerd/services/wger/wgerpkg/django-sortedm2m.nix
Normal file
49
machines/gerd/services/wger/wgerpkg/django-sortedm2m.nix
Normal file
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
lib,
|
||||
buildPythonPackage,
|
||||
fetchFromGitHub,
|
||||
setuptools,
|
||||
wheel,
|
||||
coverage,
|
||||
isort,
|
||||
pycodestyle,
|
||||
pylint-django,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "django-sortedm2m";
|
||||
version = "4.0.0";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "jazzband";
|
||||
repo = "django-sortedm2m";
|
||||
rev = version;
|
||||
hash = "sha256-Jr3C6teU4On2PiJJV9vW4EEPEuknNCZRVMDMmrs6VY8=";
|
||||
};
|
||||
|
||||
build-system = [
|
||||
setuptools
|
||||
wheel
|
||||
];
|
||||
|
||||
dependencies = [
|
||||
coverage
|
||||
isort
|
||||
pycodestyle
|
||||
pylint-django
|
||||
setuptools
|
||||
];
|
||||
|
||||
pythonImportsCheck = [
|
||||
# "django_sortedm2m"
|
||||
];
|
||||
|
||||
meta = {
|
||||
description = "A transparent sorted ManyToMany field for django";
|
||||
homepage = "https://github.com/jazzband/django-sortedm2m";
|
||||
changelog = "https://github.com/jazzband/django-sortedm2m/blob/${src.rev}/CHANGES.rst";
|
||||
license = lib.licenses.bsd3;
|
||||
maintainers = with lib.maintainers; [ ];
|
||||
};
|
||||
}
|
63
machines/gerd/services/wger/wgerpkg/frontend.nix
Normal file
63
machines/gerd/services/wger/wgerpkg/frontend.nix
Normal file
|
@ -0,0 +1,63 @@
|
|||
{
|
||||
lib,
|
||||
python3,
|
||||
fetchFromGitHub,
|
||||
mkYarnPackage,
|
||||
fetchYarnDeps,
|
||||
sass,
|
||||
stdenv,
|
||||
yarn,
|
||||
fixup-yarn-lock,
|
||||
}:
|
||||
|
||||
let
|
||||
src = fetchFromGitHub {
|
||||
owner = "wger-project";
|
||||
repo = "wger";
|
||||
rev = "bfca74e88f6c9ff6e917e0ba0e8e9c782ae0047b";
|
||||
hash = "sha256-VuVKgkNp6Omiag72lOn6p51kC/jvApX/kRAPpK95U7w=";
|
||||
};
|
||||
|
||||
offlineCache = fetchYarnDeps {
|
||||
yarnLock = "${src}/yarn.lock";
|
||||
hash = "sha256-olRU6ZGh6bpZ/WfwIKeREJRGd3oo7kEffFx8+4+7s5k=";
|
||||
};
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
pname = "tetrio-plus";
|
||||
version = "1.0.0";
|
||||
|
||||
src = src;
|
||||
|
||||
nativeBuildInputs = [
|
||||
yarn
|
||||
fixup-yarn-lock
|
||||
sass
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
export HOME=$(mktemp -d)
|
||||
|
||||
yarn config --offline set yarn-offline-mirror ${offlineCache}
|
||||
fixup-yarn-lock yarn.lock
|
||||
yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
|
||||
|
||||
sass wger/core/static/scss/main.scss wger/core/static/yarn/bootstrap-compiled.css
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp -a wger/core/static $out/static
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "";
|
||||
homepage = "https://github.com/wger-project/wger";
|
||||
license = lib.licenses.agpl3Only;
|
||||
maintainers = with lib.maintainers; [ ];
|
||||
mainProgram = "wger";
|
||||
};
|
||||
}
|
55
machines/gerd/services/wger/wgerpkg/openfoodfacts.nix
Normal file
55
machines/gerd/services/wger/wgerpkg/openfoodfacts.nix
Normal file
|
@ -0,0 +1,55 @@
|
|||
{
|
||||
lib,
|
||||
buildPythonPackage,
|
||||
fetchFromGitHub,
|
||||
poetry-core,
|
||||
pydantic,
|
||||
requests,
|
||||
tqdm,
|
||||
pillow,
|
||||
redis,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "openfoodfacts-python";
|
||||
version = "2.2.0";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "openfoodfacts";
|
||||
repo = "openfoodfacts-python";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-aG+zbFr7lhh5OCdPe7h2XJSwok7sdrnpsEBzPgJ6Bas=";
|
||||
};
|
||||
|
||||
build-system = [
|
||||
poetry-core
|
||||
];
|
||||
|
||||
dependencies = [
|
||||
pydantic
|
||||
requests
|
||||
tqdm
|
||||
];
|
||||
|
||||
optional-dependencies = {
|
||||
Pillow = [
|
||||
pillow
|
||||
];
|
||||
redis = [
|
||||
redis
|
||||
];
|
||||
};
|
||||
|
||||
pythonImportsCheck = [
|
||||
"openfoodfacts"
|
||||
];
|
||||
|
||||
meta = {
|
||||
description = "Python package for Open Food Facts";
|
||||
homepage = "https://github.com/openfoodfacts/openfoodfacts-python";
|
||||
changelog = "https://github.com/openfoodfacts/openfoodfacts-python/blob/${src.rev}/CHANGELOG.md";
|
||||
license = with lib.licenses; [ mit asl20 ];
|
||||
maintainers = with lib.maintainers; [ ];
|
||||
};
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
diff --git a/django_bootstrap_breadcrumbs/templatetags/django_bootstrap_breadcrumbs.py b/django_bootstrap_breadcrumbs/templatetags/django_bootstrap_breadcrumbs.py
|
||||
index 0e98c65..4a4c13e 100644
|
||||
--- a/django_bootstrap_breadcrumbs/templatetags/django_bootstrap_breadcrumbs.py
|
||||
+++ b/django_bootstrap_breadcrumbs/templatetags/django_bootstrap_breadcrumbs.py
|
||||
@@ -12,7 +12,7 @@ from inspect import ismethod
|
||||
|
||||
from django.utils.html import escape
|
||||
from django.utils.safestring import mark_safe
|
||||
-from django.utils.encoding import smart_text
|
||||
+from django.utils.encoding import smart_str
|
||||
from django.db.models import Model
|
||||
from django.conf import settings
|
||||
from django import template, VERSION
|
||||
@@ -148,7 +148,7 @@ def render_breadcrumbs(context, *args):
|
||||
kwargs=view_kwargs, current_app=current_app)
|
||||
except NoReverseMatch:
|
||||
url = viewname
|
||||
- links.append((url, smart_text(label) if label else label))
|
||||
+ links.append((url, smart_str(label) if label else label))
|
||||
|
||||
if not links:
|
||||
return ''
|
36
machines/gerd/services/wger/wgerpkg/patches/manage.patch
Normal file
36
machines/gerd/services/wger/wgerpkg/patches/manage.patch
Normal file
|
@ -0,0 +1,36 @@
|
|||
diff --git a/manage.py b/manage.py
|
||||
index 873291be6..368de89fe 100644
|
||||
--- a/manage.py
|
||||
+++ b/manage.py
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
# Standard Library
|
||||
import sys
|
||||
+import os
|
||||
|
||||
# Django
|
||||
from django.core.management import execute_from_command_line
|
||||
@@ -12,13 +13,20 @@ from wger.tasks import (
|
||||
setup_django_environment,
|
||||
)
|
||||
|
||||
-
|
||||
-if __name__ == '__main__':
|
||||
+def main():
|
||||
# If user passed the settings flag ignore the default wger settings
|
||||
- if not any('--settings' in s for s in sys.argv):
|
||||
+ settings_file = os.getenv("WGER_SETTINGS")
|
||||
+
|
||||
+ if not any('--settings' in s for s in sys.argv) and not settings_file:
|
||||
setup_django_environment(get_path('settings.py'))
|
||||
|
||||
+ if settings_file:
|
||||
+ setup_django_environment(get_path(settings_file))
|
||||
+
|
||||
# Alternative to above
|
||||
# os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
|
||||
|
||||
execute_from_command_line(sys.argv)
|
||||
+
|
||||
+if __name__ == '__main__':
|
||||
+ main()
|
24
machines/gerd/services/wger/wgerpkg/patches/pyproject.patch
Normal file
24
machines/gerd/services/wger/wgerpkg/patches/pyproject.patch
Normal file
|
@ -0,0 +1,24 @@
|
|||
diff --git a/pyproject.toml b/pyproject.toml
|
||||
index f10460b1e..62377bd9c 100644
|
||||
--- a/pyproject.toml
|
||||
+++ b/pyproject.toml
|
||||
@@ -35,7 +35,8 @@ Issues = "https://github.com/wger-project/wger/issues"
|
||||
Changelog = "https://wger.readthedocs.io/en/latest/changelog.html"
|
||||
|
||||
[project.scripts]
|
||||
-wger = "wger.__main__:main"
|
||||
+wger = "wger.tasks:main"
|
||||
+manage = "wger.manage:main"
|
||||
|
||||
[tool.setuptools]
|
||||
include-package-data = false
|
||||
@@ -47,6 +48,9 @@ dependencies = { file = ["requirements.txt"] }
|
||||
[tool.distutils.bdist_wheel]
|
||||
universal = 1
|
||||
|
||||
+[tool.hatch.build.targets.wheel.force-include]
|
||||
+"wger/settings_global.py" = "wger/settings_global.py"
|
||||
+
|
||||
|
||||
[tool.ruff]
|
||||
# Exclude a variety of commonly ignored directories.
|
35
machines/gerd/services/wger/wgerpkg/patches/tasks.patch
Normal file
35
machines/gerd/services/wger/wgerpkg/patches/tasks.patch
Normal file
|
@ -0,0 +1,35 @@
|
|||
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()
|
||||
|
|
@ -9,15 +9,15 @@ in sources // {
|
|||
name = "nixpkgs-patched";
|
||||
patches = [
|
||||
# tmp - lldap: 0.5.1-unstable-2024-08-09 -> 0.5.1-unstable-2024-10-30
|
||||
(pkgs.fetchpatch {
|
||||
url = "https://github.com/NixOS/nixpkgs/pull/352840.patch";
|
||||
sha256 = "sha256-O4zxn4AgUrggCkqUEkmVsUAbMTL/Jhki6Q+j1mhHWLw=";
|
||||
})
|
||||
# (pkgs.fetchpatch {
|
||||
# url = "https://github.com/NixOS/nixpkgs/pull/352840.patch";
|
||||
# sha256 = "sha256-O4zxn4AgUrggCkqUEkmVsUAbMTL/Jhki6Q+j1mhHWLw=";
|
||||
# })
|
||||
# tmp - stalwart-mail.webadmin: pin wasm-bindgen-cli version
|
||||
(pkgs.fetchpatch {
|
||||
url = "https://github.com/NixOS/nixpkgs/pull/353360.patch";
|
||||
sha256 = "sha256-WPNnvVmtySyEk58kVIYWVx3VN8MhX4v2ITLLnUGhpz4=";
|
||||
})
|
||||
# (pkgs.fetchpatch {
|
||||
# url = "https://github.com/NixOS/nixpkgs/pull/353360.patch";
|
||||
# sha256 = "sha256-WPNnvVmtySyEk58kVIYWVx3VN8MhX4v2ITLLnUGhpz4=";
|
||||
# })
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
"homepage": "",
|
||||
"owner": "nix-community",
|
||||
"repo": "disko",
|
||||
"rev": "856a2902156ba304efebd4c1096dbf7465569454",
|
||||
"sha256": "0r5yxld3yshrd09hblwzf9sadsa6p8nc24xadpajxldk2pskdmmi",
|
||||
"rev": "2814a5224a47ca19e858e027f7e8bff74a8ea9f1",
|
||||
"sha256": "1ayxw37arc92frzq0080w7kixdmqbq4jm8a19nrgivb70ra1mqys",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/nix-community/disko/archive/856a2902156ba304efebd4c1096dbf7465569454.tar.gz",
|
||||
"url": "https://github.com/nix-community/disko/archive/2814a5224a47ca19e858e027f7e8bff74a8ea9f1.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||
},
|
||||
"impermanence": {
|
||||
|
@ -29,10 +29,10 @@
|
|||
"homepage": "",
|
||||
"owner": "nix-community",
|
||||
"repo": "impermanence",
|
||||
"rev": "0d09341beeaa2367bac5d718df1404bf2ce45e6f",
|
||||
"sha256": "0s6wb425pp2906mavcpwk9mnjw94xhzmvhqf711986kzlbjlflav",
|
||||
"rev": "3ed3f0eaae9fcc0a8331e77e9319c8a4abd8a71a",
|
||||
"sha256": "1k30ig9b5bx51f0y617yvcn61bgpahf8r0i55mnl3hy6nqjbfw07",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/nix-community/impermanence/archive/0d09341beeaa2367bac5d718df1404bf2ce45e6f.tar.gz",
|
||||
"url": "https://github.com/nix-community/impermanence/archive/3ed3f0eaae9fcc0a8331e77e9319c8a4abd8a71a.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||
},
|
||||
"nixpkgs": {
|
||||
|
@ -41,10 +41,10 @@
|
|||
"homepage": null,
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "7ffd9ae656aec493492b44d0ddfb28e79a1ea25d",
|
||||
"sha256": "0mny4jzyimbfr2amc751nl2rwdlxz6wffadvygk8ra225sr3ma0f",
|
||||
"rev": "ac35b104800bff9028425fec3b6e8a41de2bbfff",
|
||||
"sha256": "1fbj7shlmviilmgz5z2gp59j6xwgdr01jfh75qhixx06kib4305p",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/7ffd9ae656aec493492b44d0ddfb28e79a1ea25d.tar.gz",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/ac35b104800bff9028425fec3b6e8a41de2bbfff.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue