nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenvNoCC,
4 buildFHSEnv,
5 fetchzip,
6 nix-update-script,
7}:
8
9let
10 arch =
11 {
12 aarch64-darwin = "arm64";
13 aarch64-linux = "arm64";
14 x86_64-darwin = "x64";
15 x86_64-linux = "x64";
16 }
17 ."${stdenvNoCC.hostPlatform.system}"
18 or (throw "Unsupported system: ${stdenvNoCC.hostPlatform.system}");
19 os =
20 {
21 aarch64-darwin = "darwin";
22 aarch64-linux = "linux";
23 x86_64-darwin = "darwin";
24 x86_64-linux = "linux";
25 }
26 ."${stdenvNoCC.hostPlatform.system}"
27 or (throw "Unsupported system: ${stdenvNoCC.hostPlatform.system}");
28
29 executableName = "copilot-language-server";
30 fhs =
31 { package }:
32 buildFHSEnv {
33 name = package.meta.mainProgram;
34 version = package.version;
35 targetPkgs = pkgs: [ pkgs.stdenv.cc.cc.lib ];
36 runScript = lib.getExe package;
37
38 meta = package.meta // {
39 description =
40 package.meta.description
41 + " (FHS-wrapped, expand package details for further information when to use it)";
42 longDescription = "Use this version if you encounter an error like `Could not start dynamically linked executable` or `SyntaxError: Invalid or unexpected token` (see nixpkgs issue [391730](https://github.com/NixOS/nixpkgs/issues/391730)).";
43 };
44 };
45in
46stdenvNoCC.mkDerivation (finalAttrs: {
47 pname = "copilot-language-server";
48 version = "1.351.0";
49
50 src = fetchzip {
51 url = "https://github.com/github/copilot-language-server-release/releases/download/${finalAttrs.version}/copilot-language-server-native-${finalAttrs.version}.zip";
52 hash = "sha256-/ohvUK5jNLpV3G+xGH2ZPsY44ZnIgsvgKp5KqSjk5VI=";
53 stripRoot = false;
54 };
55
56 installPhase = ''
57 runHook preInstall
58
59 install "${os}-${arch}/${executableName}" -Dm755 -t "$out"/bin
60
61 runHook postInstall
62 '';
63
64 dontStrip = true;
65
66 passthru = {
67 updateScript = nix-update-script { };
68 fhs = fhs { package = finalAttrs.finalPackage; };
69 };
70
71 meta = {
72 description = "Use GitHub Copilot with any editor or IDE via the Language Server Protocol";
73 homepage = "https://github.com/features/copilot";
74 license = {
75 deprecated = false;
76 free = false;
77 fullName = "GitHub Copilot Product Specific Terms";
78 redistributable = false;
79 shortName = "GitHub Copilot License";
80 url = "https://github.com/customer-terms/github-copilot-product-specific-terms";
81 };
82 mainProgram = executableName;
83 platforms = [
84 "x86_64-linux"
85 "aarch64-linux"
86 "x86_64-darwin"
87 "aarch64-darwin"
88 ];
89 maintainers = with lib.maintainers; [
90 arunoruto
91 wattmto
92 ];
93 };
94})