-
Notifications
You must be signed in to change notification settings - Fork 101
Expand file tree
/
Copy pathpackage.nix
More file actions
75 lines (65 loc) · 2.1 KB
/
package.nix
File metadata and controls
75 lines (65 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{
lib,
buildNpmPackage,
fetchzip,
versionCheckHook,
fetchNpmDepsWithPackuments,
npmConfigHook,
nodejs,
runCommand,
makeWrapper,
}:
let
versionData = builtins.fromJSON (builtins.readFile ./hashes.json);
inherit (versionData) version hash npmDepsHash;
# Create a source with the vendored package-lock.json included
src = runCommand "copilot-language-server-src-with-lock" { } ''
mkdir -p $out
cp -r ${
fetchzip {
url = "https://registry.npmjs.org/@github/copilot-language-server/-/copilot-language-server-${version}.tgz";
inherit hash;
}
}/* $out/
cp ${./package-lock.json} $out/package-lock.json
'';
in
buildNpmPackage {
inherit npmConfigHook nodejs;
pname = "copilot-language-server";
inherit version src;
npmDeps = fetchNpmDepsWithPackuments {
inherit src;
name = "copilot-language-server-${version}-npm-deps";
hash = npmDepsHash;
fetcherVersion = 2;
};
makeCacheWritable = true;
nativeBuildInputs = [ makeWrapper ];
# Skip optional platform-specific dependencies (not needed with Node.js 22+)
npmFlags = [
"--ignore-scripts"
"--omit=optional"
];
dontNpmBuild = true;
# Fix the broken bin wrapper path created by npm for scoped packages
postInstall = ''
rm -rf $out/bin
mkdir -p $out/bin
makeWrapper ${nodejs}/bin/node $out/bin/copilot-language-server \
--add-flags "$out/lib/node_modules/@github/copilot-language-server/dist/language-server.js"
'';
doInstallCheck = true;
nativeInstallCheckInputs = [ versionCheckHook ];
passthru.category = "Utilities";
meta = with lib; {
description = "GitHub Copilot Language Server - AI pair programmer LSP";
homepage = "https://github.com/github/copilot-language-server-release";
changelog = "https://github.com/github/copilot-language-server-release/releases/tag/${version}";
downloadPage = "https://www.npmjs.com/package/@github/copilot-language-server";
license = licenses.mit;
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
mainProgram = "copilot-language-server";
platforms = platforms.all;
};
}