Skip to content

Commit

Permalink
weblate: init at 5.6.2 (#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
erictapen authored Jul 31, 2024
1 parent e9b6035 commit 6fa0891
Show file tree
Hide file tree
Showing 10 changed files with 3,653 additions and 3 deletions.
85 changes: 84 additions & 1 deletion flake.lock

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

15 changes: 13 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
inputs.sops-nix.url = "github:Mic92/sops-nix";
inputs.buildbot-nix.inputs.nixpkgs.follows = "nixpkgs";
inputs.buildbot-nix.url = "github:Mic92/buildbot-nix";
inputs.poetry2nix.inputs.nixpkgs.follows = "nixpkgs";
inputs.poetry2nix.inputs.flake-utils.follows = "flake-utils";
inputs.poetry2nix.url = "github:nix-community/poetry2nix";

# See <https://github.com/ngi-nix/ngipkgs/issues/24> for plans to support Darwin.
inputs.systems.url = "github:nix-systems/default-linux";
Expand All @@ -27,6 +30,7 @@
pre-commit-hooks,
dream2nix,
buildbot-nix,
poetry2nix,
...
} @ inputs: let
# Take Nixpkgs' lib and update it with the definitions in ./lib.nix
Expand Down Expand Up @@ -100,11 +104,14 @@
}
// (filterAttrs (_: v: v != null) rawNixosModules);

# Next, extend the modules with the sops-nix module, used in the tests.
# Next, extend the modules with modules that are additionally required in the tests and examples.
extendedNixosModules =
nixosModules
// {
sops-nix = sops-nix.nixosModules.default;
poetry2nix = {
nixpkgs.overlays = [poetry2nix.overlays.default];
};
};

mkNixosSystem = config: nixosSystem {modules = [config ./dummy.nix] ++ attrValues extendedNixosModules;};
Expand All @@ -121,6 +128,7 @@
inherit inputs;
examples = rawExamples;
modules = extendedNixosModules;
inherit nixpkgs;
};
};

Expand All @@ -139,7 +147,10 @@
eachDefaultSystemOutputs = flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [overlay];
overlays = [
overlay
poetry2nix.overlays.default
];
};

ngiPackages = importNgiPackages pkgs;
Expand Down
22 changes: 22 additions & 0 deletions pkgs/by-name/weblate/cache.lock.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/weblate/utils/lock.py b/weblate/utils/lock.py
index 53c1486bc9..a0a5fc5a74 100644
--- a/weblate/utils/lock.py
+++ b/weblate/utils/lock.py
@@ -43,8 +43,6 @@ class WeblateLock:
self._name = self._format_template(cache_template)
self._lock = cache.lock(
key=self._name,
- expire=3600,
- auto_renewal=True,
)
self._enter_implementation = self._enter_redis
else:
@@ -62,7 +60,7 @@ class WeblateLock:

def _enter_redis(self):
try:
- lock_result = self._lock.acquire(timeout=self._timeout)
+ lock_result = self._lock.acquire()
except AlreadyAcquired:
return

162 changes: 162 additions & 0 deletions pkgs/by-name/weblate/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
{
stdenv,
lib,
fetchFromGitHub,
poetry2nix,
pkg-config,
openssl,
isocodes,
gettext,
maturin,
rustPlatform,
postgresql,
leptonica,
tesseract,
gobject-introspection,
wrapGAppsNoGuiHook,
pango,
harfbuzz,
librsvg,
gdk-pixbuf,
}:
poetry2nix.mkPoetryApplication {
src = fetchFromGitHub {
owner = "WeblateOrg";
repo = "weblate";
rev = "weblate-5.6.2";
sha256 = "sha256-t/hnigsKjdWCkUd8acNWhYVFmZ7oGn74+12347MkFgM=";
};

pyproject = ./pyproject.toml;
poetrylock = ./poetry.lock;

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

makeWrapperArgs = [
"\${gappsWrapperArgs[@]}"
];

nativeBuildInputs = [
wrapGAppsNoGuiHook
gobject-introspection
];

dontWrapGApps = true;

overrides = poetry2nix.overrides.withDefaults (
self: super: {
aeidon = super.aeidon.overridePythonAttrs (old: {
src = fetchFromGitHub {
owner = "otsaloma";
repo = "gaupol";
rev = "1.15";
sha256 = "sha256-lhNyeieeiBBm3rNDEU0BuWKeM6XYlOtv1voW8tR8cUM=";
};
nativeBuildInputs = [self.setuptools self.flake8 gettext];
buildInputs = [isocodes];
installPhase = ''
${self.python.interpreter} setup.py --without-gaupol install --prefix=$out
'';
});
fluent-syntax = super.fluent-syntax.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [self.setuptools];
});
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];
});
borgbackup = super.borgbackup.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [self.setuptools-scm];
});
siphashc = super.siphashc.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [self.setuptools];
});
translate-toolkit = super.translate-toolkit.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [self.setuptools];
});
weblate-language-data = super.weblate-language-data.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [self.setuptools];
});
translation-finder = super.translation-finder.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [self.setuptools];
});
weblate-schemas = super.weblate-schemas.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [self.setuptools];
});
diff-match-patch = super.diff-match-patch.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [self.flit-core];
});
editables = super.editables.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [self.flit-core];
});
nh3 = super.nh3.overridePythonAttrs (old: {
nativeBuildInputs =
(old.nativeBuildInputs or [])
++ [
maturin
rustPlatform.maturinBuildHook
rustPlatform.cargoSetupHook
];
cargoDeps = let
getCargoHash = version:
{
"0.2.17" = "sha256-WomlVzKOUfcgAWGJInSvZn9hm+bFpgc4nJbRiyPCU64=";
}
.${version};
in
rustPlatform.fetchCargoTarball {
inherit (old) src;
name = "${old.pname}-${old.version}";
hash = getCargoHash old.version;
};
});
crispy-bootstrap3 = super.crispy-bootstrap3.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [self.setuptools];
});
psycopg = super.psycopg.overridePythonAttrs (
old: {
buildInputs =
(old.buildInputs or [])
++ lib.optional stdenv.isDarwin openssl;
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [postgresql];
}
);
tesserocr = super.tesserocr.overridePythonAttrs (
old: {
buildInputs = (old.buildInputs or []) ++ [leptonica tesseract];
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [pkg-config];
}
);
ahocorasick-rs = super.ahocorasick-rs.overridePythonAttrs (
old: {
nativeBuildInputs =
(old.nativeBuildInputs or [])
++ [
rustPlatform.maturinBuildHook
rustPlatform.cargoSetupHook
];
cargoDeps = rustPlatform.fetchCargoTarball {
inherit (old) src;
name = "${old.pname}-${old.version}";
hash = "sha256-CIt/ChNcoqKln6PgeTGp9pfmIWlJj+c5SCPtBhsnT6U=";
};
}
);
}
);

meta = with lib; {
description = "Web based translation tool with tight version control integration";
homepage = "https://weblate.org/";
license = licenses.gpl3Plus;
maintainers = with maintainers; [erictapen];
};
}
Loading

0 comments on commit 6fa0891

Please sign in to comment.