1{ lib
2, stdenv
3, rustPlatform
4, fetchFromGitHub
5, help2man
6, installShellFiles
7, libiconv
8, Security
9, CoreServices
10, nix-update-script
11}:
12
13let
14 isCross = stdenv.hostPlatform != stdenv.buildPlatform;
15in
16rustPlatform.buildRustPackage rec {
17 pname = "texlab";
18 version = "5.19.0";
19
20 src = fetchFromGitHub {
21 owner = "latex-lsp";
22 repo = "texlab";
23 rev = "refs/tags/v${version}";
24 hash = "sha256-iH7KqZddP4uKwTBxLLMURUtWBsuEtLHGQppVgGFaWZQ=";
25 };
26
27 cargoHash = "sha256-QW+q869bVAMYv4SCj/2eKrADoDonrvQuaHuanZHIjMo=";
28
29 outputs = [ "out" ] ++ lib.optional (!isCross) "man";
30
31 nativeBuildInputs = [ installShellFiles ]
32 ++ lib.optional (!isCross) help2man;
33
34 buildInputs = lib.optionals stdenv.isDarwin [
35 libiconv
36 Security
37 CoreServices
38 ];
39
40 # When we cross compile we cannot run the output executable to
41 # generate the man page
42 postInstall = lib.optionalString (!isCross) ''
43 # TexLab builds man page separately in CI:
44 # https://github.com/latex-lsp/texlab/blob/v5.16.1/.github/workflows/publish.yml#L117-L121
45 help2man --no-info "$out/bin/texlab" > texlab.1
46 installManPage texlab.1
47 '';
48
49 passthru.updateScript = nix-update-script { };
50
51 meta = with lib; {
52 description = "Implementation of the Language Server Protocol for LaTeX";
53 homepage = "https://github.com/latex-lsp/texlab";
54 changelog = "https://github.com/latex-lsp/texlab/blob/v${version}/CHANGELOG.md";
55 license = licenses.mit;
56 maintainers = with maintainers; [ doronbehar kira-bruneau ];
57 platforms = platforms.all;
58 mainProgram = "texlab";
59 };
60}