Closed DieracDelta closed 1 year ago
Sure.
require
s that file and grabs the package path out of it: https://gitlab.com/jcdickinson/nix/-/blob/main/home/files/nvim/lua/jcdickinson/util.lua#L88Thanks for the response, this is super helpful!
I'm trying to generate everything at compile(build?) time using nix sort like this. Is there an option to pass in the path to the wrapped binary during setup? I'm hoping I can build a derivation that fetches the binary and fhs wrap it (or auto-patchelf it if possible; I'm hoping to run this on a mac too), and pass the path to that into my generated lua config file.
I pushed an update for this. You can set language_server
under the tools to declare an explicit path.
Thanks so much!! For others trying on nix, this is working for me now.
I'm pretty new to NixOS, still learning how Flakes work etc. I'd really like to get Codeium working via this plugin however, but I'm struggling. Would it be possible to provide a kind of "minimum viable setup" example?
My current setup is in a repo here, with the home-manager config here and Neovim here. Any pointers would be really gratefully received!
Bring in codium as a dependency:
codium-nvim-src = {
url = "github:jcdickinson/codeium.nvim";
flake = false;
};
Create the derivation for the lsp:
codium-lsp = with prev;
stdenv.mkDerivation rec {
pname = "codium-lsp";
version = "v1.1.33";
src = fetchurl {
url = "https://github.com/Exafunction/codeium/releases/download/language-server-v1.1.33/language_server_macos_arm.gz";
sha256 = "sha256-NYf0hSNO6bmICBFjpnzOvuKRBqPG7ijhdfbO02iOTBI=";
};
nativeBuildInputs = [
# autoPatchelfHook
];
buildInputs = [
];
phases = [ "installPhase" ];
# sourceRoot = ".";
installPhase = ''
mkdir -p $out/bin
gzip -d $src -c > $out/bin/language_server
chmod +x $out/bin/language_server
'';
}
;
Create the vim plugin:
let
withSrc = pkg: src: pkg.overrideAttrs (_: { inherit src; });
plugin = pname: src: prev.vimUtils.buildVimPluginFrom2Nix {
inherit pname src;
version = "master";
};
in
codium-nvim = plugin "codium-nvim" codium-nvim-src;
You want both of the above in an overlay you apply when you import nixpkgs. Then list codium-nvim
in your plugins list and then in your init.lua call:
require("codeium").setup({
tools = { language_server = "{pkgs.codium-lsp}/bin/language_server"
}
})
I have made the flake.nix in this repo actually useful. It will deal with the server for you. You can use it with (updated with tested example :P):
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-22.11";
flake-utils.url = "github:numtide/flake-utils";
codeium = {
url = "github:jcdickinson/codeium.nvim";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
nixpkgs,
flake-utils,
codeium,
...
}
:
flake-utils.lib.eachDefaultSystem (
system: let
overlays = [codeium.overlays.${system}.default];
pkgs = import nixpkgs {
inherit system overlays;
};
in {
formatter = pkgs.alejandra;
packages = with pkgs; {
nvimWithCodeium = neovim.override {
configure = {
customRC = ''
lua require("codeium").setup()
'';
packages.myPlugins = {
start = [vimPlugins.codeium-nvim vimPlugins.plenary-nvim vimPlugins.nvim-cmp];
};
};
};
};
devShell = pkgs.mkShell {
packages = [];
};
}
);
}
Thank you for this! All working now. Hugely appreciated.
Cool project! Is there an example usage of setting this up with nix I can base my config on? (maybe a personal flake or something)