fix(utils): remove unnecessary `$` from variable in arithmetic (#380537)
[NixPkgs.git] / pkgs / by-name / co / codeium / package.nix
blob747d90807aaf361633af99d91929b83bb204692f
2   stdenv,
3   lib,
4   fetchurl,
5   gzip,
6   autoPatchelfHook,
7   versionCheckHook,
8 }:
9 let
11   inherit (stdenv.hostPlatform) system;
12   throwSystem = throw "Unsupported system: ${system}";
14   plat =
15     {
16       x86_64-linux = "linux_x64";
17       aarch64-linux = "linux_arm";
18       x86_64-darwin = "macos_x64";
19       aarch64-darwin = "macos_arm";
21     }
22     .${system} or throwSystem;
24   hash =
25     {
26       x86_64-linux = "sha256-+u1WLD/EPkbFcpjMhJqAMzsh4DaaykfPUIzH7D0OLS8=";
27       aarch64-linux = "sha256-7gbevNNvvf03oVy1wcnD8b1hj5ccPyyMDfPEZyL6cdM=";
28       x86_64-darwin = "sha256-aQdOaenIv5+7dqRPvChU5UeWwll75/qQXwP7mbZxFXg=";
29       aarch64-darwin = "sha256-xKqKHEc4DSymmZ12dcs1dqhVhyYB97tdUX1pQFyJpuE=";
30     }
31     .${system} or throwSystem;
33   bin = "$out/bin/codeium_language_server";
36 stdenv.mkDerivation (finalAttrs: {
37   pname = "codeium";
38   version = "1.32.1";
39   src = fetchurl {
40     name = "${finalAttrs.pname}-${finalAttrs.version}.gz";
41     url = "https://github.com/Exafunction/codeium/releases/download/language-server-v${finalAttrs.version}/language_server_${plat}.gz";
42     inherit hash;
43   };
45   nativeBuildInputs = [ gzip ] ++ lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];
47   dontUnpack = true;
48   dontConfigure = true;
49   dontBuild = true;
51   installPhase = ''
52     runHook preInstall
53     mkdir -p $out/bin
54     gzip -dc $src > ${bin}
55     chmod +x ${bin}
56     runHook postInstall
57   '';
59   nativeInstallCheckInputs = [
60     versionCheckHook
61   ];
62   versionCheckProgram = "${placeholder "out"}/bin/codeium_language_server";
63   versionCheckProgramArg = [ "--version" ];
64   doInstallCheck = true;
66   passthru.updateScript = ./update.sh;
68   meta = rec {
69     description = "Codeium language server";
70     longDescription = ''
71       Codeium proprietary language server, patched for Nix(OS) compatibility.
72       bin/language_server_x must be symlinked into the plugin directory, replacing the existing binary.
73       For example:
74       ```shell
75       ln -s "$(which codeium_language_server)" /home/a/.local/share/JetBrains/Rider2023.1/codeium/662505c9b23342478d971f66a530cd102ae35df7/language_server_linux_x64
76       ```
77     '';
78     homepage = "https://codeium.com/";
79     downloadPage = homepage;
80     changelog = homepage;
81     license = lib.licenses.unfree;
82     maintainers = with lib.maintainers; [ anpin ];
83     mainProgram = "codeium_language_server";
84     platforms = [
85       "aarch64-darwin"
86       "aarch64-linux"
87       "x86_64-linux"
88       "x86_64-darwin"
89     ];
90     sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
91   };