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; formatter = pkgs.nixfmt;
packages = { packages = {
jlink = pkgs.callPackage ./externals/packages/jlink { }; jlink = pkgs.callPackage ./externals/packages/jlink { };
nvim = inputs.nixvim.legacyPackages."${system}".makeNixvim nvim = inputs.nixvim.legacyPackages."${system}".makeNixvimWithModule {
(import ./sets/nvim.nix { inherit pkgs inputs; }); extraSpecialArgs = { inherit inputs; };
module = import ./sets/nvim.nix {
path = [ ];
inherit (pkgs) lib;
};
};
}; };
}); });
} }

View file

@ -1,4 +1,11 @@
{ inputs, pkgs, ... }@args: { { inputs, lib, ... }@args: {
imports = [ inputs.nixvim.nixosModules.nixvim ]; imports = [
programs.nixvim = import ./nvim.nix args // { enable = true; }; 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; vimAlias = true;
enableMan = false; enableMan = false;
@ -59,21 +61,21 @@
# LSP # LSP
plugins.rust-tools = { plugins.rust-tools = {
enable = true; enable = cfg.plugins.lsp.enable;
server.standalone = false; server.standalone = false;
}; };
plugins.clangd-extensions.enable = true; plugins.clangd-extensions.enable = cfg.plugins.lsp.enable;
plugins.lsp = { plugins.lsp = {
enable = true; enable = lib.mkDefault true;
servers = { servers = {
clangd.enable = true; clangd.enable = cfg.plugins.lsp.enable;
java-language-server.enable = true; java-language-server.enable = cfg.plugins.lsp.enable;
jsonls.enable = true; jsonls.enable = cfg.plugins.lsp.enable;
nil_ls.enable = true; nil_ls.enable = cfg.plugins.lsp.enable;
pylsp.enable = true; pylsp.enable = cfg.plugins.lsp.enable;
texlab.enable = true; texlab.enable = cfg.plugins.lsp.enable;
tsserver.enable = true; tsserver.enable = cfg.plugins.lsp.enable;
typst-lsp.enable = true; typst-lsp.enable = cfg.plugins.lsp.enable;
}; };
keymaps = { keymaps = {
@ -169,4 +171,4 @@
}) })
end end
''; '';
} })

View file

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