about summary refs log tree commit diff
path: root/pkgs/tools/misc/zotero-translation-server/default.nix
blob: 923d9d4de8fb147e28cceca079b93b04d6eed191 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{ lib, buildNpmPackage, fetchFromGitHub, nodejs }:

buildNpmPackage rec {
  pname = "zotero-translation-server";
  version = "unstable-2023-07-13";

  src = fetchFromGitHub {
    owner = "zotero";
    repo = "translation-server";
    rev = "cf96d57f4e2af66fee7df9bad00681b3f4ac7d77";
    hash = "sha256-GJn7UAl0raVGzplvFzo4A0RUjNbyGt/YI2mt1UZIJv0=";
    fetchSubmodules = true;
  };

  npmDepsHash = "sha256-JHoBxUybs1GGRxEVG5GgX2mOCplTgR5dcPjnR42SEbY=";

  makeCacheWritable = true;

  dontNpmBuild = true;

  postInstall = ''
    mkdir -p $out/bin/ $out/share/zotero-translation-server/
    makeWrapper ${nodejs}/bin/node $out/bin/translation-server \
      --add-flags "$out/lib/node_modules/translation-server/src/server.js"
    ln -s $out/lib/node_modules/translation-server/config $out/share/zotero-translation-server/config
    ln -s $out/lib/node_modules/translation-server/modules $out/share/zotero-translation-server/modules
  '';

  meta = with lib; {
    description = "Node.js-based server to run Zotero translators";
    homepage = "https://github.com/zotero/translation-server";
    license = licenses.agpl3Only;
    maintainers = [ ];
    mainProgram = "translation-server";
  };
}