about summary refs log tree commit diff
path: root/nixpkgs/pkgs/by-name/co/codeium/package.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/by-name/co/codeium/package.nix')
-rw-r--r--nixpkgs/pkgs/by-name/co/codeium/package.nix69
1 files changed, 69 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/by-name/co/codeium/package.nix b/nixpkgs/pkgs/by-name/co/codeium/package.nix
new file mode 100644
index 000000000000..38ad126e5ce9
--- /dev/null
+++ b/nixpkgs/pkgs/by-name/co/codeium/package.nix
@@ -0,0 +1,69 @@
+{ stdenv, lib, fetchurl, gzip, autoPatchelfHook }:
+let
+
+  inherit (stdenv.hostPlatform) system;
+  throwSystem = throw "Unsupported system: ${system}";
+
+  plat = {
+    x86_64-linux = "linux_x64";
+    aarch64-linux = "linux_arm";
+    x86_64-darwin = "macos_x64";
+    aarch64-darwin = "macos_arm";
+
+  }.${system} or throwSystem;
+
+  hash = {
+    x86_64-linux = "sha256-9EGoJ5DoGgVfbhCDeTvn1D7misJEj9jPwuiOK7z95Ts=";
+    aarch64-linux = "sha256-lO0YOSiO8AUrkbV+3Uyvg6p3bdAcTze3La2g5IcK1f0=";
+    x86_64-darwin = "sha256-WjvC3pt8Gd4q+BzrOhyGeYwZIbv2m5O3pSXe1N7Najw=";
+    aarch64-darwin = "sha256-IRm5m/Jaf4pmAzx+MXwmHLejo6Gv2OL56R1IEr/NlZU=";
+  }.${system} or throwSystem;
+
+  bin = "$out/bin/codeium_language_server";
+
+in
+stdenv.mkDerivation (finalAttrs: {
+  pname = "codeium";
+  version = "1.2.104";
+  src = fetchurl {
+    name = "${finalAttrs.pname}-${finalAttrs.version}.gz";
+    url = "https://github.com/Exafunction/codeium/releases/download/language-server-v${finalAttrs.version}/language_server_${plat}.gz";
+    inherit hash;
+  };
+
+  nativeBuildInputs = [ gzip ] ++ lib.optionals stdenv.isLinux [ autoPatchelfHook ];
+
+  dontUnpack = true;
+  dontConfigure = true;
+  dontBuild = true;
+
+  installPhase = ''
+    runHook preInstall
+    mkdir -p $out/bin
+    gzip -dc $src > ${bin}
+    chmod +x ${bin}
+    runHook postInstall
+  '';
+
+  passthru.updateScript = ./update.sh;
+
+  meta = rec {
+    description = "Codeium language server";
+    longDescription = ''
+      Codeium proprietary language server, patched for Nix(OS) compatibility.
+      bin/language_server_x must be symlinked into the plugin directory, replacing the existing binary.
+      For example:
+      ```shell
+      ln -s "$(which codeium_language_server)" /home/a/.local/share/JetBrains/Rider2023.1/codeium/662505c9b23342478d971f66a530cd102ae35df7/language_server_linux_x64
+      ```
+    '';
+    homepage = "https://codeium.com/";
+    downloadPage = homepage;
+    changelog = homepage;
+    license = lib.licenses.unfree;
+    maintainers = with lib.maintainers; [ anpin ];
+    mainProgram = "codeium";
+    platforms = [ "aarch64-darwin" "aarch64-linux" "x86_64-linux" "x86_64-darwin" ];
+    sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
+  };
+})