Skip to content

Commit

Permalink
weblate: 5.6.2 -> 5.7
Browse files Browse the repository at this point in the history
Changelog: https://github.com/WeblateOrg/weblate/releases/tag/weblate-5.7

Also had to rework django-compressor settings and aligned them more
closely with the official docs:
https://cheat.readthedocs.io/en/latest/django/compressor.html
  • Loading branch information
erictapen committed Aug 15, 2024
1 parent 04f5adb commit ca18f1c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 21 deletions.
15 changes: 11 additions & 4 deletions nixos/modules/services/web-apps/weblate.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ let
SESSION_COOKIE_SECURE = ENABLE_HTTPS
DATA_DIR = "${dataDir}"
CACHE_DIR = f"{DATA_DIR}/cache"
STATIC_ROOT = "${finalPackage.static}/static"
STATIC_ROOT = "${finalPackage.static}"
MEDIA_ROOT = "/var/lib/weblate/media"
COMPRESS_ROOT = "${finalPackage.static}/compressor-cache"
COMPRESS_ROOT = "${finalPackage.static}"
COMPRESS_OFFLINE = True
DEBUG = False
DATABASES = {
Expand Down Expand Up @@ -86,6 +87,13 @@ let
VCS_BACKENDS = ("weblate.vcs.git.GitRepository",)
SITE_URL = "https://{}".format(SITE_DOMAIN)
# WebAuthn
OTP_WEBAUTHN_RP_NAME = SITE_TITLE
OTP_WEBAUTHN_RP_ID = SITE_DOMAIN.split(":")[0]
OTP_WEBAUTHN_ALLOWED_ORIGINS = [SITE_URL]
''
+ lib.optionalString cfg.smtp.enable ''
ADMINS = (("Weblate Admin", "${cfg.smtp.user}"),)
Expand Down Expand Up @@ -205,8 +213,7 @@ in

locations = {
"= /favicon.ico".alias = "${finalPackage}/${python.sitePackages}/weblate/static/favicon.ico";
"/static/".alias = "${finalPackage.static}/static/";
"/static/CACHE/".alias = "${finalPackage.static}/compressor-cache/CACHE/";
"/static/".alias = "${finalPackage.static}/";
"/media/".alias = "/var/lib/weblate/media/";
"/".proxyPass = "http://unix:///run/weblate.socket";
};
Expand Down
25 changes: 8 additions & 17 deletions pkgs/by-name/we/weblate/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ let
in
python.pkgs.buildPythonApplication rec {
pname = "weblate";
version = "5.6.2";
version = "5.7";

pyproject = true;

Expand All @@ -47,35 +47,23 @@ python.pkgs.buildPythonApplication rec {
owner = "WeblateOrg";
repo = "weblate";
rev = "weblate-${version}";
sha256 = "sha256-t/hnigsKjdWCkUd8acNWhYVFmZ7oGn74+12347MkFgM=";
sha256 = "sha256-h5+0lOMD+H0ehtZ0bngA9bI5va1I5KjZH9boaEtXJPo=";
};

patches = [
# FIXME This shouldn't be necessary and probably has to do with some dependency mismatch.
./cache.lock.patch
];

# Relax dependency constraints
# mistletoe: https://github.com/WeblateOrg/weblate/commit/50df46a25dda2b7b39de86d4c65ecd7a685f62e6
# borgbackup: https://github.com/WeblateOrg/weblate/commit/355c81c977c59948535a98a35a5c05d7e6909703
# django-crispy-forms: https://github.com/WeblateOrg/weblate/commit/7b341c523ed9b3b41ecfbc5c92dd6156992e4f32
postPatch = ''
substituteInPlace pyproject.toml \
--replace '"mistletoe>=1.3.0,<1.4"' '"mistletoe>=1.3.0,<1.5"' \
--replace '"borgbackup>=1.2.5,<1.3"' '"borgbackup>=1.2.5,<1.5"' \
--replace '"django-crispy-forms>=2.1,<2.3"' '"django-crispy-forms>=2.1,<2.4"'
'';

build-system = with python.pkgs; [ setuptools ];

# Build static files into a separate output
postBuild =
let
staticSettings = writeText "static_settings.py" ''
STATIC_ROOT = os.environ["static"] + "/static"
COMPRESS_ENABLED = True
DEBUG = False
STATIC_ROOT = os.environ["static"]
COMPRESS_OFFLINE = True
COMPRESS_ROOT = os.environ["static"] + "/compressor-cache"
# So we don't need postgres dependencies
DATABASES = {}
'';
Expand All @@ -99,6 +87,7 @@ python.pkgs.buildPythonApplication rec {
cryptography
cssselect
cython
cyrtranslit
diff-match-patch
django-appconf
django-celery-beat
Expand All @@ -107,6 +96,8 @@ python.pkgs.buildPythonApplication rec {
django-crispy-forms
django-filter
django-redis
django-otp
django-otp-webauthn
django
djangorestframework
filelock
Expand All @@ -117,7 +108,6 @@ python.pkgs.buildPythonApplication rec {
iniparse
jsonschema
lxml
misaka
mistletoe
nh3
openpyxl
Expand All @@ -131,6 +121,7 @@ python.pkgs.buildPythonApplication rec {
pyparsing
python-dateutil
python-redis-lock
qrcode
rapidfuzz
redis
requests
Expand Down

0 comments on commit ca18f1c

Please sign in to comment.