nixvim: Make configuration proper module

This commit is contained in:
Artemis Tosini 2023-11-29 04:27:07 +00:00
parent 8ecbbd8861
commit 10c58ce06d
Signed by: artemist
GPG key ID: ADFFE553DCBB831E
4 changed files with 36 additions and 26 deletions

View file

@ -86,8 +86,13 @@
formatter = pkgs.nixfmt;
packages = {
jlink = pkgs.callPackage ./externals/packages/jlink { };
nvim = inputs.nixvim.legacyPackages."${system}".makeNixvim
(import ./sets/nvim.nix { inherit pkgs inputs; });
nvim = inputs.nixvim.legacyPackages."${system}".makeNixvimWithModule {
extraSpecialArgs = { inherit inputs; };
module = import ./sets/nvim.nix {
path = [ ];
inherit (pkgs) lib;
};
};
};
});
}

View file

@ -1,4 +1,11 @@
{ inputs, pkgs, ... }@args: {
imports = [ inputs.nixvim.nixosModules.nixvim ];
programs.nixvim = import ./nvim.nix args // { enable = true; };
{ inputs, lib, ... }@args: {
imports = [
inputs.nixvim.nixosModules.nixvim
(import ./nvim.nix {
inherit lib;
path = [ "programs" "nixvim" ];
})
];
programs.nixvim.enable = true;
}

View file

@ -1,6 +1,8 @@
{ pkgs, ... }:
{
{ lib, path }:
{ pkgs, config, ... }:
let setPath = if path == [ ] then [ "config" ] else path;
in lib.setAttrByPath setPath (let cfg = lib.getAttrFromPath path config;
in {
vimAlias = true;
enableMan = false;
@ -59,21 +61,21 @@
# LSP
plugins.rust-tools = {
enable = true;
enable = cfg.plugins.lsp.enable;
server.standalone = false;
};
plugins.clangd-extensions.enable = true;
plugins.clangd-extensions.enable = cfg.plugins.lsp.enable;
plugins.lsp = {
enable = true;
enable = lib.mkDefault true;
servers = {
clangd.enable = true;
java-language-server.enable = true;
jsonls.enable = true;
nil_ls.enable = true;
pylsp.enable = true;
texlab.enable = true;
tsserver.enable = true;
typst-lsp.enable = true;
clangd.enable = cfg.plugins.lsp.enable;
java-language-server.enable = cfg.plugins.lsp.enable;
jsonls.enable = cfg.plugins.lsp.enable;
nil_ls.enable = cfg.plugins.lsp.enable;
pylsp.enable = cfg.plugins.lsp.enable;
texlab.enable = cfg.plugins.lsp.enable;
tsserver.enable = cfg.plugins.lsp.enable;
typst-lsp.enable = cfg.plugins.lsp.enable;
};
keymaps = {
@ -169,4 +171,4 @@
})
end
'';
}
})

View file

@ -39,12 +39,8 @@
publish.enable = true;
};
# Require a lot of dependencies we don't use
programs.nixvim.plugins = {
rust-tools.enable = lib.mkForce false;
clangd-extensions.enable = lib.mkForce false;
lsp.enable = lib.mkForce false;
};
# Requires a lot of dependencies we don't use
programs.nixvim.plugins.lsp.enable = false;
environment.systemPackages = with pkgs; [
magic-wormhole