nix-community / nix-vscode-extensions

Nix expressions for VSCode and OpenVSX extensions [maintainers: @deemp, @AmeerTaweel]
MIT License
229 stars 13 forks source link

codeium extension is not usable because it wants to download a binary on a read-only system #79

Open dasj19 opened 2 months ago

dasj19 commented 2 months ago

Hello, I wanted to get codeium working and I faced issues because the extension expected to be able to download a binary that will den run.

What I tried, with home-manager:

programs.vscode.extensions = with pkgs.vscode-marketplace; with pkgs.vscode-extensions; [
   codeium.codeium
];

It would be nice if it would work that way, but I then tried a workaround:

programs.vscode.extensions =
  let
      codium-vsix = pkgs.vscode-utils.buildVscodeMarketplaceExtension rec {
        mktplcRef = {
          name = "codeium";
          version = "1.17.1";
          publisher = "Codeium";
        };
        vsix = builtins.fetchurl {
            url = "https://marketplace.visualstudio.com/_apis/public/gallery/publishers/Codeium/vsextensions/codeium/1.17.1/vspackage";
            sha256 = "1ds9qcp7q2a84ia78ggwshlnj988sylv8zfh9zvdhbwb77lh93v1";
          };
        language-server = builtins.fetchurl {
          url = "https://github.com/Exafunction/codeium/releases/download/language-server-v1.16.1/language_server_linux_x64";
          sha256 = "0rsrc51p4mccy4xzs4mk6x1a53ay451m7cam95kzpkva7rbk9k8p";
        };

        nativeBuildInputs = [ pkgs.unzip ];
        buildInputs = [ pkgs.codeium ];
        unpackPhase = ''
          runHook preUnpack

          mkdir -p extension/dist/40c19f24318b082e366fe4260c6c56b2316bb655
          unzip ${vsix}

          # This does not work.
          # cp ${language-server} extension/dist/40c19f24318b082e366fe4260c6c56b2316bb655/language_server_linux_x64
          # chmod +777 extension/dist/40c19f24318b082e366fe4260c6c56b2316bb655/language_server_linux_x64

          ln -s /home/daniel/system/home-manager/codium/language_server_linux_x64 extension/dist/40c19f24318b082e366fe4260c6c56b2316bb655/language_server_linux_x64
          runHook postUnpack
        '';
        installPhase = ''
        '';
      };
  in
    with pkgs.vscode-marketplace; with pkgs.vscode-extensions; [
    codium-vsix
  ];

I would like a more generic solution, without having to keep the language server binary in my home folder unmanaged by nixos or home-manager. Any advice is welcomed. Thanks