vuls: init at 0.27.0 (#348530)
[NixPkgs.git] / pkgs / by-name / as / astro-language-server / package.nix
blob33d0b5aedc5e6a24b261b1484c63132c14c7a01b
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   pnpm,
6   nodejs_22,
7 }:
9 stdenv.mkDerivation (finalAttrs: {
10   pname = "astro-language-server";
11   version = "2.15.0";
13   src = fetchFromGitHub {
14     owner = "withastro";
15     repo = "language-tools";
16     rev = "@astrojs/language-server@${finalAttrs.version}";
17     hash = "sha256-2MaoW04mX016VIrtfnBX/jzMNCOXE10lSInSyhqot5E=";
18   };
20   pnpmDeps = pnpm.fetchDeps {
21     inherit (finalAttrs)
22       pname
23       version
24       src
25       pnpmWorkspace
26       prePnpmInstall
27       ;
28     hash = "sha256-zCCDlwsKPZQVEYrv85WcMY2JlWgz0tD6iHLSJg1RkRU=";
29   };
31   nativeBuildInputs = [
32     nodejs_22
33     pnpm.configHook
34   ];
36   buildInputs = [ nodejs_22 ];
38   # Must specify to download "@astrojs/yaml2ts" depencendies
39   # https://pnpm.io/filtering#--filter-package_name-1
40   pnpmWorkspace = "@astrojs/language-server...";
41   prePnpmInstall = ''
42     # Warning section for "pnpm@v8"
43     # https://pnpm.io/cli/install#--filter-package_selector
44     pnpm config set dedupe-peer-dependents false
45   '';
47   buildPhase = ''
48     runHook preBuild
50     # Must build the "@astrojs/yaml2ts" package. Dependency is linked via workspace by "pnpm"
51     # (https://github.com/withastro/language-tools/blob/%40astrojs/language-server%402.14.2/pnpm-lock.yaml#L78-L80)
52     pnpm --filter "@astrojs/language-server..." build
54     runHook postBuild
55   '';
57   installPhase = ''
58     runHook preInstall
60     mkdir -p $out/{bin,lib/astro-language-server}
61     cp -r {packages,node_modules} $out/lib/astro-language-server
62     ln -s $out/lib/astro-language-server/packages/language-server/bin/nodeServer.js $out/bin/astro-ls
64     runHook postInstall
65   '';
67   meta = {
68     description = "The Astro language server";
69     homepage = "https://github.com/withastro/language-tools";
70     changelog = "https://github.com/withastro/language-tools/blob/@astrojs/language-server@${finalAttrs.version}/packages/language-server/CHANGELOG.md";
71     license = lib.licenses.mit;
72     maintainers = with lib.maintainers; [ pyrox0 ];
73     mainProgram = "astro-ls";
74     platforms = lib.platforms.unix;
75   };