diff --git a/nixos/modules/services/web-apps/weblate.nix b/nixos/modules/services/web-apps/weblate.nix index 398d634a2b928..4f13ad87ee03b 100644 --- a/nixos/modules/services/web-apps/weblate.nix +++ b/nixos/modules/services/web-apps/weblate.nix @@ -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 = { @@ -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}"),) @@ -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"; }; diff --git a/pkgs/by-name/we/weblate/package.nix b/pkgs/by-name/we/weblate/package.nix index 3b499ce31ada8..f3eec5c4aa7c9 100644 --- a/pkgs/by-name/we/weblate/package.nix +++ b/pkgs/by-name/we/weblate/package.nix @@ -34,7 +34,7 @@ let in python.pkgs.buildPythonApplication rec { pname = "weblate"; - version = "5.6.2"; + version = "5.7"; pyproject = true; @@ -47,7 +47,7 @@ python.pkgs.buildPythonApplication rec { owner = "WeblateOrg"; repo = "weblate"; rev = "weblate-${version}"; - sha256 = "sha256-t/hnigsKjdWCkUd8acNWhYVFmZ7oGn74+12347MkFgM="; + sha256 = "sha256-h5+0lOMD+H0ehtZ0bngA9bI5va1I5KjZH9boaEtXJPo="; }; patches = [ @@ -55,27 +55,15 @@ python.pkgs.buildPythonApplication rec { ./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 = {} ''; @@ -99,6 +87,7 @@ python.pkgs.buildPythonApplication rec { cryptography cssselect cython + cyrtranslit diff-match-patch django-appconf django-celery-beat @@ -107,6 +96,8 @@ python.pkgs.buildPythonApplication rec { django-crispy-forms django-filter django-redis + django-otp + django-otp-webauthn django djangorestframework filelock @@ -117,7 +108,6 @@ python.pkgs.buildPythonApplication rec { iniparse jsonschema lxml - misaka mistletoe nh3 openpyxl @@ -131,6 +121,7 @@ python.pkgs.buildPythonApplication rec { pyparsing python-dateutil python-redis-lock + qrcode rapidfuzz redis requests diff --git a/pkgs/development/python-modules/cyrtranslit/default.nix b/pkgs/development/python-modules/cyrtranslit/default.nix new file mode 100644 index 0000000000000..03e32e91d4c56 --- /dev/null +++ b/pkgs/development/python-modules/cyrtranslit/default.nix @@ -0,0 +1,35 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + setuptools, + unittestCheckHook, +}: + +buildPythonPackage rec { + pname = "cyrtranslit"; + version = "1.1.1"; + pyproject = true; + + # Pypi tarball doesn't contain tests/ + src = fetchFromGitHub { + owner = "opendatakosovo"; + repo = "cyrillic-transliteration"; + rev = "v${version}"; + sha256 = "sha256-t8UTOmjGqjmxU7+Po0/HmOPWAvcgZibaUC9dMlttA/0="; + }; + + build-system = [ setuptools ]; + + nativeCheckInputs = [ unittestCheckHook ]; + + pythonImportsCheck = [ "cyrtranslit" ]; + + meta = with lib; { + description = "Transliterate Cyrillic script to Latin script and vice versa"; + homepage = "https://github.com/opendatakosovo/cyrillic-transliteration"; + license = licenses.mit; + maintainers = with maintainers; [ erictapen ]; + }; + +} diff --git a/pkgs/development/python-modules/django-otp-webauthn/default.nix b/pkgs/development/python-modules/django-otp-webauthn/default.nix new file mode 100644 index 0000000000000..870e36cbcb4ed --- /dev/null +++ b/pkgs/development/python-modules/django-otp-webauthn/default.nix @@ -0,0 +1,44 @@ +{ + lib, + buildPythonPackage, + fetchPypi, + hatchling, + django, + django-otp, + djangorestframework, + webauthn, +}: + +buildPythonPackage rec { + pname = "django-otp-webauthn"; + version = "0.3.0"; + pyproject = true; + + src = fetchPypi { + inherit version; + pname = "django_otp_webauthn"; + sha256 = "sha256-+Y46/PDeXL9zayoZykaU63faQmnLHzYPmqJJeRBx+hs="; + }; + + build-system = [ hatchling ]; + + dependencies = [ + django + django-otp + djangorestframework + webauthn + ]; + + # Tests are on the roadmap, but not yet implemented + + pythonImportsCheck = [ "django_otp_webauthn" ]; + + meta = with lib; { + description = "Passkey support for Django"; + homepage = "https://github.com/Stormbase/django-otp-webauthn"; + changelog = "https://github.com/Stormbase/django-otp-webauthn/blob/main/CHANGELOG.md"; + license = licenses.bsd3; + maintainers = with maintainers; [ erictapen ]; + }; + +} diff --git a/pkgs/development/python-modules/django-otp/default.nix b/pkgs/development/python-modules/django-otp/default.nix index fa38355d1ebcf..a2982d48a64fc 100644 --- a/pkgs/development/python-modules/django-otp/default.nix +++ b/pkgs/development/python-modules/django-otp/default.nix @@ -12,14 +12,14 @@ buildPythonPackage rec { pname = "django-otp"; - version = "1.5.0"; + version = "1.5.1"; pyproject = true; src = fetchFromGitHub { owner = "django-otp"; repo = "django-otp"; rev = "v${version}"; - hash = "sha256-c0Yr41S1LFBzcDIK2etOP3rYcCPaThDs+XGiw4WP/ks="; + hash = "sha256-1tatp4CQowaHZ5w9IPiKZ3rT5jREXZnwK9iSAYaUhis="; }; build-system = [ hatchling ]; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 350a7d4225ba9..2592757e03c68 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -2761,6 +2761,8 @@ self: super: with self; { cypherpunkpay = callPackage ../development/python-modules/cypherpunkpay { }; + cyrtranslit = callPackage ../development/python-modules/cyrtranslit { }; + cysignals = callPackage ../development/python-modules/cysignals { }; cython = callPackage ../development/python-modules/cython { }; @@ -3393,6 +3395,8 @@ self: super: with self; { django-otp = callPackage ../development/python-modules/django-otp { }; + django-otp-webauthn = callPackage ../development/python-modules/django-otp-webauthn { }; + django-paintstore = callPackage ../development/python-modules/django-paintstore { }; django-parler = callPackage ../development/python-modules/django-parler { };