2 modelSpecs = (builtins.fromJSON (builtins.readFile ./models.json));
5 { lib, stdenvNoCC, fetchurl }:
8 withCodeAsKey = f: { code, ... }@attrs: lib.nameValuePair code (f attrs);
9 mkModelPackage = { name, code, version, url, checksum }:
10 stdenvNoCC.mkDerivation {
11 pname = "translatelocally-model-${code}";
12 version = toString version;
21 TARGET="$out/share/translateLocally/models"
23 tar -xzf "$src" -C "$TARGET"
25 # avoid patching shebangs in inconsistently executable extra files
26 find "$out" -type f -exec chmod -x {} +
30 description = "translateLocally model - ${name}";
31 homepage = "https://translatelocally.com/";
32 # https://github.com/browsermt/students/blob/master/LICENSE.md
33 license = lib.licenses.cc-by-sa-40;
37 lib.listToAttrs (map (withCodeAsKey mkModelPackage) modelSpecs);
40 passthru.updateScript = ./update.sh;