nixos/modules/home/shell/neovim.nix
2024-08-12 14:07:28 +02:00

63 lines
1.7 KiB
Nix

{
lib,
config,
pkgs,
...
}: let
cfg = config.myConfig.shell.neovim;
in {
options.myConfig.shell.neovim = {
enable = lib.mkEnableOption "neovim";
};
config = lib.mkIf cfg.enable {
programs.neovim = {
enable = true;
vimAlias = true;
vimdiffAlias = true;
withNodeJs = true;
defaultEditor = true;
plugins = with pkgs.vimPlugins; [
lazy-nvim
];
extraLuaConfig = ''
-- This file simply bootstraps the installation of Lazy.nvim and then calls other files for execution
-- This file doesn't necessarily need to be touched, BE CAUTIOUS editing this file and proceed at your own risk.
local lazypath = vim.env.LAZY or vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
if not (vim.env.LAZY or (vim.uv or vim.loop).fs_stat(lazypath)) then
-- stylua: ignore
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end
vim.opt.rtp:prepend(lazypath)
-- validate that lazy is available
if not pcall(require, "lazy") then
-- stylua: ignore
vim.api.nvim_echo({ { ("Unable to load lazy from: %s\n"):format(lazypath), "ErrorMsg" }, { "Press any key to exit...", "MoreMsg" } }, true, {})
vim.fn.getchar()
vim.cmd.quit()
end
require "lazy_setup"
'';
extraPackages = with pkgs; [
gnumake
clang
gcc
zig
cargo
rust-analyzer
rustup
nodejs
];
};
# home.file.".config/nvim/lua".source = ./nvim-lua;
xdg.configFile."nvim/lua" = {
recursive = true;
source = ./nvim-lua;
};
};
}