Closed qverkk closed 1 year ago
Oh sorry ! this was meant just for me to make a patch file and apply it on NixOS, this can be closed :D maybe if other NixOS users will want to set codeium, they can use this PR as a patch entrypoint
Sounds good, I will close this. Feel free to leave a note in issues, discussions, wiki, etc. to point to this for future users.
@qverkk I'm curious as to why steam-run will work, hitting this same isssue but having steam for this seems... wrong
@qverkk I'm curious as to why steam-run will work, hitting this same isssue but having steam for this seems... wrong
The binaries are downloaded automatically by codeium, which is why it's hard to make a patch or a general deriveiation for nix to add it to your path. One way of doing it manually is by running
patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
language_server_linux_x64
to make the file executable. I have chose to use steam-run as it was way easier. Also it's not directly linked to steam as u may think. Here is a more detailed answer: https://unix.stackexchange.com/a/522823
@qverkk I'm curious as to why steam-run will work, hitting this same isssue but having steam for this seems... wrong
The binaries are downloaded automatically by codeium, which is why it's hard to make a patch or a general deriveiation for nix to add it to your path. One way of doing it manually is by running
patchelf \ --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ language_server_linux_x64
to make the file executable. I have chose to use steam-run as it was way easier. Also it's not directly linked to steam as u may think. Here is a more detailed answer: https://unix.stackexchange.com/a/522823
yeah after I asked I found the answer, I went ahead and made a derivation for the language server:
with import <nixpkgs> {};
stdenv.mkDerivation rec {
name = "codeium";
src = fetchurl {
url =
"https://github.com/Exafunction/codeium/releases/download/language-server-v1.2.28/language_server_linux_x64";
sha256 = "sha256-jvRrTSevGEC+j/bdt6bfPEhk/t0jG5YT3P0MachWoSk=";
};
nativeBuildInputs = [ autoPatchelfHook ];
unpackPhase = "true";
installPhase = ''
ls -lR $src
mkdir -p $out/bin
cp $src $out/bin/language_server_linux_x64
chmod +x $out/bin/language_server_linux_x64
'';
}
and then I use it in my home-manager:
home = {
file = {
codeium_ls = {
target = ".codeium/bin/02626b4ccb9ec6fa5d7ad27101ebb1480e2a80fb/language_server_linux_x64";
source = "${codeium-ls}/bin/language_server_linux_x64";
};
}
@qverkk I'm curious as to why steam-run will work, hitting this same isssue but having steam for this seems... wrong
The binaries are downloaded automatically by codeium, which is why it's hard to make a patch or a general deriveiation for nix to add it to your path. One way of doing it manually is by running
patchelf \ --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ language_server_linux_x64
to make the file executable. I have chose to use steam-run as it was way easier. Also it's not directly linked to steam as u may think. Here is a more detailed answer: https://unix.stackexchange.com/a/522823
yeah after I asked I found the answer, I went ahead and made a derivation for the language server:
with import <nixpkgs> {}; stdenv.mkDerivation rec { name = "codeium"; src = fetchurl { url = "https://github.com/Exafunction/codeium/releases/download/language-server-v1.2.28/language_server_linux_x64"; sha256 = "sha256-jvRrTSevGEC+j/bdt6bfPEhk/t0jG5YT3P0MachWoSk="; }; nativeBuildInputs = [ autoPatchelfHook ]; unpackPhase = "true"; installPhase = '' ls -lR $src mkdir -p $out/bin cp $src $out/bin/language_server_linux_x64 chmod +x $out/bin/language_server_linux_x64 ''; }
and then I use it in my home-manager:
home = { file = { codeium_ls = { target = ".codeium/bin/02626b4ccb9ec6fa5d7ad27101ebb1480e2a80fb/language_server_linux_x64"; source = "${codeium-ls}/bin/language_server_linux_x64"; }; }
Oh damn, great job ! Did u skip the pkgs.codeium package available in the 23.05 and unstable release altogether? Cause the following path migth change codeium/bin/02626b4ccb9ec6fa5d7ad27101ebb1480e2a80fb/language_server_linux_x64
yeah I added my own codeium.vim, but I imagine the sha can be somewhat automated as well, if I end up using codeium I'll probably do it a bit better.
codeium = pkgs.vimUtils.buildVimPluginFrom2Nix {
name = "codeium-nvim";
src = pkgs.fetchFromGitHub {
owner = "Exafunction";
repo = "codeium.vim";
rev = "1.2.26";
hash = "sha256-gc4BP4ufE6UPJanskhvoab0vTM3t5b2egPKaV1X5KW0=";
};
};
Ah this is similiar to what nixpkgs currently has :D https://github.com/NixOS/nixpkgs/blob/a558f7ac29f50c4b937fb5c102f587678ae1c9fb/pkgs/applications/editors/vim/plugins/generated.nix#LL1964C7-L1964C7
Lmk if the unique id in .codium
will ever change with ur approach :D u can add me on discord if u want: qverkk
For now, the easiest way to make it work is using an alias like this:
{
programs.bash.shellAliases = {
nvim = "steam-run nvim";
};
}
We can't unconditionally run this on all operating systems. Is there a simple way to detect NixOS?