nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 nodejs_22,
6 gitMinimal,
7 gitSetupHook,
8 pnpm_8,
9 fetchPnpmDeps,
10 pnpmConfigHook,
11 nix-update-script,
12}:
13let
14 pnpm' = pnpm_8.override { nodejs = nodejs_22; };
15in
16stdenv.mkDerivation (finalAttrs: {
17 pname = "vtsls";
18 version = "0.2.9";
19
20 src = fetchFromGitHub {
21 owner = "yioneko";
22 repo = "vtsls";
23 tag = "server-v${finalAttrs.version}";
24 hash = "sha256-vlw84nigvQqRB9OQBxOmrR9CClU9M4dNgF/nrvGN+sk=";
25 fetchSubmodules = true;
26 };
27
28 nativeBuildInputs = [
29 nodejs_22
30 # patches are applied with git during build
31 gitMinimal
32 gitSetupHook
33 pnpmConfigHook
34 pnpm'
35 ];
36
37 buildInputs = [ nodejs_22 ];
38
39 pnpmWorkspaces = [ "@vtsls/language-server" ];
40
41 pnpmDeps = fetchPnpmDeps {
42 inherit (finalAttrs)
43 pnpmWorkspaces
44 pname
45 src
46 version
47 ;
48 pnpm = pnpm';
49 fetcherVersion = 1;
50 hash = "sha256-SdqeTYRH60CyU522+nBo0uCDnzxDP48eWBAtGTL/pqg=";
51 };
52
53 # Patches to get submodule sha from file instead of 'git submodule status'
54 patches = [ ./vtsls-build-patch.patch ];
55
56 # Skips manual confirmations during build
57 CI = true;
58
59 buildPhase = ''
60 runHook preBuild
61
62 # during build this sha is used as a marker to skip applying patches and
63 # copying files, which doesn't matter in this case
64 echo "dummysha" > ./packages/service/HEAD
65
66 # Requires a git repository during build
67 git init packages/service/vscode
68
69 # Depends on the @vtsls/language-service workspace
70 # '--workspace-concurrency=1' helps debug failing builds.
71 pnpm --filter "@vtsls/language-server..." build
72
73 # These trash deterministic builds. During build the whole directory is
74 # copied to another path.
75 rm -rf packages/service/vscode/.git
76 rm -rf packages/service/src/typescript-language-features/.git
77
78 runHook postBuild
79 '';
80
81 installPhase = ''
82 runHook preInstall
83
84 mkdir -p $out/{bin,lib/vtsls-language-server}
85 cp -r {packages,node_modules} $out/lib/vtsls-language-server
86 ln -s $out/lib/vtsls-language-server/packages/server/bin/vtsls.js $out/bin/vtsls
87
88 runHook postInstall
89 '';
90
91 passthru = {
92 updateScript = nix-update-script { };
93 };
94
95 meta = {
96 description = "LSP wrapper for typescript extension of vscode";
97 homepage = "https://github.com/yioneko/vtsls";
98 license = lib.licenses.mit;
99 maintainers = with lib.maintainers; [ kuglimon ];
100 mainProgram = "vtsls";
101 platforms = lib.platforms.all;
102 };
103})