1 { lib, stdenv, fetchFromGitHub
2 , cmake, qt6, libarchive, pcre2, protobuf, gperftools, blas
3 , runCommand, translatelocally, translatelocally-models
7 rev = "a210037760ca3ca9016ca1831c97531318df70fe";
9 in stdenv.mkDerivation (finalAttrs: {
10 pname = "translatelocally";
11 version = "unstable-2023-09-20";
13 src = fetchFromGitHub {
15 repo = "translateLocally";
17 hash = "sha256-T7cZdR09yDrPTwYxvDIaKTdV4mrB+gTHYVfch5BQ+PE=";
18 fetchSubmodules = true;
22 ./version_without_git.patch
26 echo '#define GIT_REVISION "${rev} ${finalAttrs.version}"' > \
27 3rd_party/bergamot-translator/3rd_party/marian-dev/src/common/git_revision.h
30 # https://github.com/XapaJIaMnu/translateLocally/blob/81ed8b9/.github/workflows/build.yml#L330
31 postConfigure = lib.optionalString stdenv.isAarch64 ''
32 bash ../cmake/fix_ruy_build.sh .. .
48 gperftools # provides tcmalloc
53 "-DBLAS_LIBRARIES=-lblas"
54 "-DCBLAS_LIBRARIES=-lcblas"
58 cli-translate = runCommand "${finalAttrs.pname}-test-cli-translate" {
61 translatelocally-models.fr-en-tiny
64 export LC_ALL="C.UTF-8"
65 echo "Bonjour" | translateLocally -m fr-en-tiny > $out
66 diff "$out" <(echo "Hello")
71 mainProgram = "translateLocally";
72 homepage = "https://translatelocally.com/";
73 description = "Fast and secure translation on your local machine, powered by marian and Bergamot.";
74 license = licenses.mit;
75 maintainers = with maintainers; [ pacien ];
76 platforms = platforms.linux;