Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
35 changes: 35 additions & 0 deletions pkgs/development/python-modules/cyrtranslit/default.nix
Original file line number Diff line number Diff line change
@@ -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 ];
};

}
44 changes: 44 additions & 0 deletions pkgs/development/python-modules/django-otp-webauthn/default.nix
Original file line number Diff line number Diff line change
@@ -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 ];
};

}
4 changes: 2 additions & 2 deletions pkgs/development/python-modules/django-otp/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 ];
Expand Down
4 changes: 4 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 { };
Expand Down Expand Up @@ -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 { };
Expand Down