about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/language-servers/typst-lsp/default.nix
blob: f6568e0ada636044e779f5f06340bbf9c6ee1ff2 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{ lib
, rustPlatform
, fetchFromGitHub
, fetchpatch
, stdenv
, darwin
}:

rustPlatform.buildRustPackage rec {
  pname = "typst-lsp";
  version = "0.10.0";

  src = fetchFromGitHub {
    owner = "nvarner";
    repo = "typst-lsp";
    rev = "v${version}";
    hash = "sha256-rsG7YZjy4UgFGsehlslsrOAD5YMpVVBI2MERlxgniVA=";
  };

  patches = [
    # git information isn't available with fetchFromGitHub
    # https://github.com/nvarner/typst-lsp/pull/303
    (fetchpatch {
      name = "fix-build-when-git-information-is-not-available.patch";
      url = "https://github.com/nvarner/typst-lsp/commit/420de6235eb1aa492337a8cc43b04134a3ffab00.patch";
      hash = "sha256-Rs9pzSUg4YNGzYnX8tbOmCwbPyZ9P18Eyg451fa2Iqg=";
    })
  ];

  cargoLock = {
    lockFile = ./Cargo.lock;
    outputHashes = {
      "typst-0.8.0" = "sha256-q2b/PoNwpzarJbIPzokYgZRD2/Oe/XB40C4VXdwL/NA=";
      "typst-syntax-0.7.0" = "sha256-yrtOmlFAKOqAmhCP7n0HQCOQpU3DWyms5foCdUb9QTg=";
      "typstfmt_lib-0.2.4" = "sha256-d0vlZqg0RcRvZM7xYdMLX2/UeolUbqZ9H4drJRRKBmc=";
    };
  };

  buildInputs = lib.optionals stdenv.isDarwin [
    darwin.apple_sdk.frameworks.Security
  ];

  checkFlags = [
    # requires internet access
    "--skip=workspace::package::external::remote_repo::test::full_download"
  ];

  # workspace::package::external::manager::test::local_package tries to access the data directory
  preCheck = ''
    export HOME=$(mktemp -d)
  '';

  meta = with lib; {
    description = "A brand-new language server for Typst";
    homepage = "https://github.com/nvarner/typst-lsp";
    changelog = "https://github.com/nvarner/typst-lsp/releases/tag/${src.rev}";
    license = with licenses; [ asl20 mit ];
    maintainers = with maintainers; [ figsoda GaetanLepage ];
  };
}