|
| 1 | +{ |
| 2 | + lib, |
| 3 | + codeium, |
| 4 | + fetchFromGitHub, |
| 5 | + fetchurl, |
| 6 | + jq, |
| 7 | + stdenv, |
| 8 | + vimPlugins, |
| 9 | + vimUtils, |
| 10 | +}: |
| 11 | +let |
| 12 | + # Update according to https://github.com/Exafunction/codeium.nvim/blob/main/lua/codeium/versions.json |
| 13 | + codeiumVersion = "1.20.9"; |
| 14 | + codeiumHashes = { |
| 15 | + x86_64-linux = "sha256-IeNK7UQtOhqC/eQv7MAya4jB1WIGykSR7IgutZatmHM="; |
| 16 | + aarch64-linux = "sha256-ujTFki/3V79El2WCkG0PJhbaMT0knC9mrS9E7Uv9HD4="; |
| 17 | + x86_64-darwin = "sha256-r2KloEQsUku9sk8h76kwyQuMTHcq/vwfTSK2dkiXDzE="; |
| 18 | + aarch64-darwin = "sha256-1jNH0Up8mAahDgvPF6g42LV+RVDVsPqDM54lE2KYY48="; |
| 19 | + }; |
| 20 | + |
| 21 | + codeium' = codeium.overrideAttrs rec { |
| 22 | + version = codeiumVersion; |
| 23 | + |
| 24 | + src = |
| 25 | + let |
| 26 | + inherit (stdenv.hostPlatform) system; |
| 27 | + throwSystem = throw "Unsupported system: ${system}"; |
| 28 | + |
| 29 | + platform = |
| 30 | + { |
| 31 | + x86_64-linux = "linux_x64"; |
| 32 | + aarch64-linux = "linux_arm"; |
| 33 | + x86_64-darwin = "macos_x64"; |
| 34 | + aarch64-darwin = "macos_arm"; |
| 35 | + } |
| 36 | + .${system} or throwSystem; |
| 37 | + |
| 38 | + hash = codeiumHashes.${system} or throwSystem; |
| 39 | + in |
| 40 | + fetchurl { |
| 41 | + name = "codeium-${version}.gz"; |
| 42 | + url = "https://github.com/Exafunction/codeium/releases/download/language-server-v${version}/language_server_${platform}.gz"; |
| 43 | + inherit hash; |
| 44 | + }; |
| 45 | + }; |
| 46 | +in |
| 47 | +vimUtils.buildVimPlugin { |
| 48 | + pname = "windsurf.nvim"; |
| 49 | + version = "0-unstable-2025-04-30"; |
| 50 | + src = fetchFromGitHub { |
| 51 | + owner = "Exafunction"; |
| 52 | + repo = "windsurf.nvim"; |
| 53 | + rev = "821b570b526dbb05b57aa4ded578b709a704a38a"; |
| 54 | + hash = "sha256-TWezce2+XrkzaiW/V3VgfX3FMdS8qFE8/FfPEK/Ii84="; |
| 55 | + }; |
| 56 | + |
| 57 | + dependencies = [ vimPlugins.plenary-nvim ]; |
| 58 | + buildPhase = '' |
| 59 | + cat << EOF > lua/codeium/installation_defaults.lua |
| 60 | + return { |
| 61 | + tools = { |
| 62 | + language_server = "${codeium'}/bin/codeium_language_server" |
| 63 | + }; |
| 64 | + }; |
| 65 | + EOF |
| 66 | + ''; |
| 67 | + |
| 68 | + doCheck = true; |
| 69 | + checkInputs = [ |
| 70 | + jq |
| 71 | + codeium' |
| 72 | + ]; |
| 73 | + checkPhase = '' |
| 74 | + runHook preCheck |
| 75 | +
|
| 76 | + expected_codeium_version=$(jq -r '.version' lua/codeium/versions.json) |
| 77 | + actual_codeium_version=$(codeium_language_server --version) |
| 78 | +
|
| 79 | + expected_codeium_stamp=$(jq -r '.stamp' lua/codeium/versions.json) |
| 80 | + actual_codeium_stamp=$(codeium_language_server --stamp | grep STABLE_BUILD_SCM_REVISION | cut -d' ' -f2) |
| 81 | +
|
| 82 | + if [ "$actual_codeium_stamp" != "$expected_codeium_stamp" ]; then |
| 83 | + echo " |
| 84 | + The version of codeium patched in vimPlugins.codeium-nvim is incorrect. |
| 85 | + Expected stamp: $expected_codeium_stamp |
| 86 | + Actual stamp: $actual_codeium_stamp |
| 87 | +
|
| 88 | + Expected codeium version: $expected_codeium_version |
| 89 | + Actual codeium version: $actual_codeium_version |
| 90 | +
|
| 91 | + Please, update 'codeiumVersion' in pkgs/applications/editors/vim/plugins/overrides.nix accordingly to: |
| 92 | + https://github.com/Exafunction/codeium.nvim/blob/main/lua/codeium/versions.json |
| 93 | + " |
| 94 | + exit 1 |
| 95 | + fi |
| 96 | +
|
| 97 | + runHook postCheck |
| 98 | + ''; |
| 99 | + |
| 100 | + meta = { |
| 101 | + description = "Native neovim extension for Codeium"; |
| 102 | + homepage = "https://github.com/Exafunction/windsurf.nvim"; |
| 103 | + license = lib.licenses.mit; |
| 104 | + platforms = lib.attrNames codeiumHashes; |
| 105 | + }; |
| 106 | +} |
0 commit comments