11{
22 lib ,
3- buildNpmPackage ,
4- fetchurl ,
3+ stdenvNoCC ,
4+ fetchzip ,
5+ nix-update-script ,
56} :
67
7- buildNpmPackage rec {
8+ let
9+ arch =
10+ {
11+ aarch64-darwin = "arm64" ;
12+ aarch64-linux = "arm64" ;
13+ x86_64-darwin = "x64" ;
14+ x86_64-linux = "x64" ;
15+ }
16+ . "${ stdenvNoCC . hostPlatform . system } "
17+ or ( throw "Unsupported system: ${ stdenvNoCC . hostPlatform . system } " ) ;
18+ os =
19+ {
20+ aarch64-darwin = "darwin" ;
21+ aarch64-linux = "linux" ;
22+ x86_64-darwin = "darwin" ;
23+ x86_64-linux = "linux" ;
24+ }
25+ . "${ stdenvNoCC . hostPlatform . system } "
26+ or ( throw "Unsupported system: ${ stdenvNoCC . hostPlatform . system } " ) ;
27+ in
28+
29+ stdenvNoCC . mkDerivation ( finalAttrs : {
830 pname = "copilot-language-server" ;
931 version = "1.280.0" ;
1032
11- src = fetchurl {
12- url = "https://registry.npmjs.org/@github/copilot-language-server/-/copilot-language-server-${ version } .tgz" ;
13- hash = "sha256-6UniNoKUoATY+7amMoyWmo0DxEM82Iuu2Jf8P2raWx4=" ;
33+ src = fetchzip {
34+ url = "https://github.com/github/copilot-language-server-release/releases/download/${ finalAttrs . version } /copilot-language-server-native-${ finalAttrs . version } .zip" ;
35+ hash = "sha256-s47WaWH0ov/UazQCOFBUAO6ZYgCmCpQ1o79KjAVJFh4=" ;
36+ stripRoot = false ;
1437 } ;
1538
16- npmDepsHash = "sha256-BtErMpXdRC0t9DNa3hKU+tct6e9K+tMP+LcbmwSJrLI=" ;
39+ npmDepsHash = "sha256-PLX/mN7xu8gMh2BkkyTncP3+rJ3nBmX+pHxl0ONXbe4=" ;
40+ installPhase = ''
41+ runHook preInstall
1742
18- postPatch = ''
19- ln -s ${ ./package-lock.json } package-lock.json
20- '' ;
43+ install -Dt "$out"/bin "${ os } -${ arch } "/copilot-language-server
2144
22- postInstall = ''
23- ln -s $out/lib/node_modules/@github/copilot-language-server/dist $out/lib/node_modules/@github/dist
45+ runHook postInstall
2446 '' ;
2547
26- dontNpmBuild = true ;
48+ dontStrip = true ;
2749
28- passthru . updateScript = ./ update.sh ;
50+ passthru . updateScript = nix- update-script { } ;
2951
3052 meta = {
3153 description = "Use GitHub Copilot with any editor or IDE via the Language Server Protocol" ;
@@ -41,9 +63,13 @@ buildNpmPackage rec {
4163 mainProgram = "copilot-language-server" ;
4264 platforms = [
4365 "x86_64-linux"
66+ "aarch64-linux"
4467 "x86_64-darwin"
4568 "aarch64-darwin"
4669 ] ;
47- maintainers = with lib . maintainers ; [ arunoruto ] ;
70+ maintainers = with lib . maintainers ; [
71+ arunoruto
72+ wattmto
73+ ] ;
4874 } ;
49- }
75+ } )
0 commit comments