Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Update weblate to 5.5.5 #5

Closed
wants to merge 3 commits into from
Closed
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
52 changes: 26 additions & 26 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 5 additions & 12 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
flake-utils.url = "github:numtide/flake-utils";
poetry2nix.url = "github:nix-community/poetry2nix";
poetry2nix.inputs.nixpkgs.follows = "nixpkgs";
weblate.url = "github:WeblateOrg/weblate/weblate-5.0.2";
weblate.url = "github:WeblateOrg/weblate/weblate-5.5.5";
weblate.flake = false;
aeidon-src.url = "github:otsaloma/gaupol/1.12";
aeidon-src.url = "github:otsaloma/gaupol/1.14.1";
aeidon-src.flake = false;
};

Expand All @@ -33,13 +33,8 @@
pyproject = ./pyproject.toml;
poetrylock = ./poetry.lock;
patches = [
# The default timeout for the celery check is much too short upstream, so
# we increase it. I guess this is due to the fact that we test the setup
# very early into the initialization of the server, so the load might be
# higher compared to production setups?
./longer-celery-wait-time.patch
# FIXME This shouldn't be necessary and probably has to do with some dependency mismatch.
./cache.lock.patch
./weird_redis_lock.diff
];
meta = with pkgs.lib; {
description = "Web based translation tool with tight version control integration";
Expand All @@ -63,9 +58,6 @@
phply = super.phply.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ self.setuptools ];
});
pygobject = super.pygobject.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ self.setuptools ];
});
pyicumessageformat = super.pyicumessageformat.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ self.setuptools ];
});
Expand Down Expand Up @@ -103,6 +95,7 @@
let
getCargoHash = version: {
"0.2.14" = "sha256-EzlwSic1Qgs4NZAde/KWg0Qjs+PNEPcnE8HyIPoYZQ0=";
"0.2.17" = "sha256-WomlVzKOUfcgAWGJInSvZn9hm+bFpgc4nJbRiyPCU64=";
}.${version};
in
pkgs.rustPlatform.fetchCargoTarball {
Expand Down Expand Up @@ -137,7 +130,7 @@
cargoDeps = pkgs.rustPlatform.fetchCargoTarball {
inherit (old) src;
name = "${old.pname}-${old.version}";
hash = "sha256-/sel54PV58y6oUgIzHXSCL4RMljPL9kZ6ER/pRTAjAI=";
hash = "sha256-CIt/ChNcoqKln6PgeTGp9pfmIWlJj+c5SCPtBhsnT6U=";
};

}
Expand Down
2 changes: 1 addition & 1 deletion integration-test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ in
nodes.server = { config, pkgs, lib, ... }: {
virtualisation.memorySize = 2048;

services.postgresql.package = pkgs.postgresql_14;
services.postgresql.package = pkgs.postgresql_15;

imports = [ weblateModule ];

Expand Down
32 changes: 16 additions & 16 deletions module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let
# TLS terminates at the reverse proxy, but this setting controls how links to weblate are generated.
ENABLE_HTTPS = True
DATA_DIR = "/var/lib/weblate"
STATIC_ROOT = "${pkgs.weblate}/lib/${pkgs.python3.libPrefix}/site-packages/weblate/static/"
STATIC_ROOT = "${pkgs.weblate}/lib/${pkgs.weblate.python.libPrefix}/site-packages/weblate/static/"
MEDIA_ROOT = "/var/lib/weblate/media"
COMPRESS_ROOT = "/var/lib/weblate/compressor-cache/"
DEBUG = False
Expand All @@ -38,7 +38,6 @@ let
"LOCATION": "unix://${config.services.redis.servers.weblate.unixSocket}",
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
"PARSER_CLASS": "redis.connection.HiredisParser",
"PASSWORD": None,
"CONNECTION_POOL_KWARGS": {},
},
Expand Down Expand Up @@ -71,7 +70,7 @@ let
'';
settings_py = pkgs.runCommand "weblate_settings.py" { } ''
mkdir -p $out
cat ${pkgs.weblate}/lib/${pkgs.python3.libPrefix}/site-packages/weblate/settings_example.py > $out/settings.py
cat ${pkgs.weblate}/lib/${pkgs.weblate.python.libPrefix}/site-packages/weblate/settings_example.py > $out/settings.py
cat >> $out/settings.py <<EOF${weblateConfig}EOF
'';
uwsgiConfig.uwsgi = {
Expand All @@ -88,7 +87,7 @@ let
chown-socket = "weblate:weblate";
uid = "weblate";
gid = "weblate";
wsgi-file = "${pkgs.weblate}/lib/${pkgs.python3.libPrefix}/site-packages/weblate/wsgi.py";
wsgi-file = "${pkgs.weblate}/lib/${pkgs.weblate.python.libPrefix}/site-packages/weblate/wsgi.py";
pyhome = pkgs.weblate.dependencyEnv;

# Some more recommendations by upstream:
Expand All @@ -106,7 +105,7 @@ let
environment = {
PYTHONPATH = "${settings_py}";
DJANGO_SETTINGS_MODULE = "settings";
GI_TYPELIB_PATH = "${pkgs.pango.out}/lib/girepository-1.0:${pkgs.harfbuzz}/lib/girepository-1.0";
GI_TYPELIB_PATH = "${pkgs.pango.out}/lib/girepository-1.0:${pkgs.harfbuzz}/lib/girepository-1.0:${lib.getLib pkgs.glib}/lib/girepository-1.0:${pkgs.librsvg}/lib/girepository-1.0:${pkgs.gdk-pixbuf}/lib/girepository-1.0";
};
weblate-env = pkgs.writeShellScriptBin
"weblate-env"
Expand Down Expand Up @@ -190,10 +189,6 @@ in
assertion = cfg.smtp.createLocally -> cfg.smtp.host == "127.0.0.1";
message = ''services.weblate.smtp.host should be "127.0.0.1" if you want to to use services.weblate.smtp.createLocally.'';
}
{
assertion = builtins.compareVersions config.services.postgresql.package.version "15.0" == -1;
message = "Weblate doesn't work with PostgreSQL 15 and higher right now (currently ${config.services.postgresql.package.version}). This is a bug in the NixOS module, so feel free to open a PR.";
}
];

services.nginx = {
Expand All @@ -204,8 +199,8 @@ in
enableACME = true;

locations = {
"= /favicon.ico".alias = "${pkgs.weblate}/lib/${pkgs.python3.libPrefix}/site-packages/weblate/static/favicon.ico";
"/static/".alias = "${pkgs.weblate}/lib/${pkgs.python3.libPrefix}/site-packages/weblate/static/";
"= /favicon.ico".alias = "${pkgs.weblate}/lib/${pkgs.weblate.python.libPrefix}/site-packages/weblate/static/favicon.ico";
"/static/".alias = "${pkgs.weblate}/lib/${pkgs.weblate.python.libPrefix}/site-packages/weblate/static/";
"/static/CACHE/".alias = "/var/lib/weblate/compressor-cache/CACHE/";
"/media/".alias = "/var/lib/weblate/media/";
"/".extraConfig = ''
Expand All @@ -228,7 +223,8 @@ in
Type = "oneshot";
User = "postgres";
Group = "postgres";
ExecStart = ''
ExecStart = pkgs.writeShellScript "setup_weblate_postgresql" ''
${pkgs.postgresql}/bin/psql weblate -c "CREATE EXTENSION IF NOT EXISTS btree_gin"
${pkgs.postgresql}/bin/psql weblate -c "CREATE EXTENSION IF NOT EXISTS pg_trgm"
'';
};
Expand Down Expand Up @@ -300,7 +296,7 @@ in
Type = "forking";
User = "weblate";
Group = "weblate";
WorkingDirectory = "${pkgs.weblate}/lib/${pkgs.python3.libPrefix}/site-packages/weblate/";
WorkingDirectory = "${pkgs.weblate}/lib/${pkgs.weblate.python.libPrefix}/site-packages/weblate/";
RuntimeDirectory = "celery";
RuntimeDirectoryPreserve = "restart";
LogsDirectory = "celery";
Expand Down Expand Up @@ -337,10 +333,13 @@ in
NotifyAccess = "all";
ExecStart =
let
uwsgi = pkgs.uwsgi.override { plugins = [ "python3" ]; };
uwsgi = pkgs.uwsgi.override {
plugins = [ "python3" ];
python3 = pkgs.weblate.python;
};
jsonConfig = pkgs.writeText "uwsgi.json" (builtins.toJSON uwsgiConfig);
in
"${uwsgi}/bin/uwsgi --json ${jsonConfig}";
"${uwsgi}/bin/uwsgi --json ${jsonConfig}";
Restart = "on-failure";
KillSignal = "SIGTERM";
WorkingDirectory = pkgs.weblate;
Expand Down Expand Up @@ -378,7 +377,8 @@ in
ensureUsers = [
{
name = "weblate";
ensurePermissions."DATABASE weblate" = "ALL PRIVILEGES";
ensureDBOwnership = true;
ensureClauses.createdb = true;
}
];
ensureDatabases = [ "weblate" ];
Expand Down
Loading