-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Per-project LSP with nixvimExtend #1
Comments
@robbins sure! This is a flake.nix that I use in typescript projects: {
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.olistrik.url = "github:olistrik/nixos-config";
outputs = { self, flake-utils, nixpkgs, ... }@inputs:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ inputs.olistrik.overlays.default ];
};
nixvim = pkgs.olistrik.nixvim.nixvimExtend {
config = {
opts = {
backupcopy = "yes"; # bun --watch gets very annoyed without this.
};
olistrik.plugins = {
lsp.enable = true; # enable my lsp keybindings.
};
plugins = {
gitblame.enable = true;
# enable the builtin ts/js lsp servers.
lsp.servers = {
eslint.enable = true;
tsserver.enable = true;
};
};
};
};
in
{
devShell = pkgs.mkShell {
packages = [ nixvim ];
};
});
} I usually put this in a gitignored
It's not perfect, I'd like to get my devshell flakes to resolve their inputs to match my system inputs. Unless I manually update all of my devshell flakes when I update my system, I wind up with a different |
Thanks, I see, so you can access the derivation of your system Nvim config and modify it in the devshell. I might start doing something like this. Regarding your last paragraph, if I'm understanding correctly, the opposite side of that problem where you use the same I think the best solution might be to have your NixVim config be a separate flake that you consume from your devshells and your system configuration - that way updates can stay in sync without rebuilding everything else. |
@robbins I've worked it out! I haven't tried without it, but I think that adding your system flake to the registry is a requirement for this to work: Line 92 in 37103f6
This is a snippet of my new .local/flake, {
description = "Project specific config for nixvim";
inputs = {
olistrik.url = "olistrik"; # references my installed system flake.
nixpkgs.follows = "olistrik/unstable"; // use the same nixpkgs as my system.
flake-utils.url = "github:numtide/flake-utils";
project = {
url = "path:/home/oli/.../some-flake-project"; # I haven't gotten this to work without the absolute path.
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};
};
outputs = { self, flake-utils, nixpkgs, project, ... }@inputs:
flake-utils.lib.eachDefaultSystem (system:
let
# ... same as before
in
{
devShells.default = pkgs.mkShell {
# this extends the projects own devshell, shellHooks included!
inputsFrom = [ project.devShells.${system}.default ];
packages = [ nixvim ];
};
});
}
This shouldn't be an issue, it still creates a lock file and pins a specific revision of my system flake. If I do a system update, the system will change to use a different store path, this project will still reference it as a gcroot.
This is a good idea, i've notice that using my flake pulls in a tone of dependencies because of all the inputs I have for xyz overlays. Very few are needed for nixvim. I'm thinking of writing a utility function for my |
Do you have an example of how you do this? It sounds super interesting :)
The text was updated successfully, but these errors were encountered: