Skip to content

Commit

Permalink
angular-language-server-bin: init at 18.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bornedj authored and tricktron committed Oct 21, 2024
1 parent 847a9f1 commit 425e0ab
Showing 1 changed file with 85 additions and 0 deletions.
85 changes: 85 additions & 0 deletions pkgs/by-name/an/angular-language-server-bin/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
lib,
stdenvNoCC,
fetchurl,
nodejs,
makeBinaryWrapper,
runCommand,
angular-language-server-bin,
writeShellApplication,
curl,
common-updater-scripts,
jq,
unzip,
}:

let
owner = "angular";
repo = "vscode-ng-language-service";
in
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "angular-language-server-bin";
version = "18.2.0";
src = fetchurl {
name = "${finalAttrs.pname}-${finalAttrs.version}.zip";
url = "https://github.com/${owner}/${repo}/releases/download/v${finalAttrs.version}/ng-template.vsix";
hash = "sha256-rl04nqSSBMjZfPW8Y+UtFLFLDFd5FSxJs3S937mhDWE=";
};

nativeBuildInputs = [
unzip
makeBinaryWrapper
];

buildInputs = [ nodejs ];

installPhase = ''
runHook preInstall
install -Dm755 server/bin/ngserver $out/bin/ngserver
install -Dm755 server/index.js $out/index.js
cp -r node_modules $out/node_modules
runHook postInstall
'';

postFixup = ''
patchShebangs $out/bin/ngserver
patchShebangs $out/index.js
patchShebangs $out/node_modules
wrapProgram $out/bin/ngserver \
--prefix PATH : ${lib.makeBinPath [ nodejs ]} \
--add-flags "--tsProbeLocations $out/node_modules --ngProbeLocations $out/node_modules"
'';

passthru = {
tests = {
start-ok = runCommand "${finalAttrs.pname}-test" { } ''
${angular-language-server-bin}/bin/ngserver --stdio --help &> $out
cat $out | grep "Angular Language Service that implements the Language Server Protocol (LSP)"
'';
};

updateScript = lib.getExe (writeShellApplication {
name = "update-${finalAttrs.pname}";
runtimeInputs = [
curl
common-updater-scripts
jq
];
text = ''
LATEST_VERSION=$(curl -H "Accept: application/vnd.github+json" \
-Ls https://api.github.com/repos/${owner}/${repo}/releases/latest | \
jq -r .tag_name | cut -c 2-)
update-source-version ${finalAttrs.pname} "$LATEST_VERSION"
'';
});
};

meta = {
description = "LSP for angular completions, AOT diagnostic, quick info and go to definitions";
homepage = "https://github.com/angular/vscode-ng-language-service";
changelog = "https://github.com/angular/vscode-ng-language-service/blob/${finalAttrs.version}/CHANGELOG.md";
license = lib.licenses.mit;
mainProgram = "ngserver";
maintainers = with lib.maintainers; [ tricktron ];
};
})

0 comments on commit 425e0ab

Please sign in to comment.