1{
2 lib,
3 stdenv,
4 rustPlatform,
5 fetchFromGitHub,
6 installShellFiles,
7 pkg-config,
8 buildPackages,
9 versionCheckHook,
10 nix-update-script,
11 vscode-extensions,
12}:
13
14rustPlatform.buildRustPackage (finalAttrs: {
15 pname = "tinymist";
16 # Please update the corresponding vscode extension when updating
17 # this derivation.
18 version = "0.13.16";
19
20 src = fetchFromGitHub {
21 owner = "Myriad-Dreamin";
22 repo = "tinymist";
23 tag = "v${finalAttrs.version}";
24 hash = "sha256-4ffFIqF+UYFKTl4dQadr2mCKDYnpIdaKKBQ/tXonfAA=";
25 };
26
27 cargoHash = "sha256-cQTfyzvnrxdcYOnmJGAqwLN4Ueqh9PkYZsiGljmcrY8=";
28
29 nativeBuildInputs = [
30 installShellFiles
31 pkg-config
32 ];
33
34 checkFlags = [
35 "--skip=e2e"
36
37 # Require internet access
38 "--skip=docs::package::tests::cetz"
39 "--skip=docs::package::tests::fletcher"
40 "--skip=docs::package::tests::tidy"
41 "--skip=docs::package::tests::touying"
42
43 # Tests are flaky for unclear reasons since the 0.12.3 release
44 # Reported upstream: https://github.com/Myriad-Dreamin/tinymist/issues/868
45 "--skip=analysis::expr_tests::scope"
46 "--skip=analysis::post_type_check_tests::test"
47 "--skip=analysis::type_check_tests::test"
48 "--skip=completion::tests::test_pkgs"
49 "--skip=folding_range::tests::test"
50 "--skip=goto_definition::tests::test"
51 "--skip=hover::tests::test"
52 "--skip=inlay_hint::tests::smart"
53 "--skip=prepare_rename::tests::prepare"
54 "--skip=references::tests::test"
55 "--skip=rename::tests::test"
56 "--skip=semantic_tokens_full::tests::test"
57 ];
58
59 postInstall = lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) (
60 let
61 emulator = stdenv.hostPlatform.emulator buildPackages;
62 in
63 ''
64 installShellCompletion --cmd tinymist \
65 --bash <(${emulator} $out/bin/tinymist completion bash) \
66 --fish <(${emulator} $out/bin/tinymist completion fish) \
67 --zsh <(${emulator} $out/bin/tinymist completion zsh)
68 ''
69 );
70
71 nativeInstallCheckInputs = [
72 versionCheckHook
73 ];
74 versionCheckProgramArg = "-V";
75 doInstallCheck = true;
76
77 passthru = {
78 updateScript = nix-update-script { };
79 tests = {
80 vscode-extension = vscode-extensions.myriad-dreamin.tinymist;
81 };
82 };
83
84 meta = {
85 description = "Tinymist is an integrated language service for Typst";
86 homepage = "https://github.com/Myriad-Dreamin/tinymist";
87 changelog = "https://github.com/Myriad-Dreamin/tinymist/blob/v${finalAttrs.version}/editors/vscode/CHANGELOG.md";
88 license = lib.licenses.asl20;
89 mainProgram = "tinymist";
90 maintainers = with lib.maintainers; [
91 GaetanLepage
92 lampros
93 ];
94 };
95})