From f011d8c78d32bd05803e4b034c9b0ae829577b01 Mon Sep 17 00:00:00 2001 From: Zynh Ludwig Date: Wed, 29 May 2024 20:31:14 -0700 Subject: [PATCH] neovim.nix --- home.nix | 44 +++++---------------------------- home/modules/neovim.nix | 55 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 38 deletions(-) create mode 100644 home/modules/neovim.nix diff --git a/home.nix b/home.nix index b72496d..d186b67 100644 --- a/home.nix +++ b/home.nix @@ -2,6 +2,7 @@ { imports = [ + ./home/modules/neovim.nix ./home/modules/git.nix ./home/modules/fish.nix ./home/modules/alacritty.nix @@ -12,6 +13,11 @@ home.username = "ravenshade"; home.homeDirectory = "/home/ravenshade"; + snowhawk.neovim = { + enable = true; + package = inputs.neovim-overlay.packages.${pkgs.system}.default; + }; + # This value determines the Home Manager release that your configuration is # compatible with. This helps avoid breakage when a new Home Manager release # introduces backwards incompatible changes. @@ -49,44 +55,6 @@ # systemd.enable = true; # }; - programs.neovim = - let - package = inputs.neovim-overlay.packages.${pkgs.system}.default; - - nvim-treesitter = pkgs.vimPlugins.nvim-treesitter; - treesitterWithGrammars = (nvim-treesitter.withPlugins (_: nvim-treesitter.allGrammars)); - - treesitter-parsers = pkgs.symlinkJoin { - name = "treesitter-parsers"; - paths = treesitterWithGrammars.dependencies; - }; - in - { - inherit package; - - enable = true; - coc.enable = false; - extraLuaConfig = '' - -- bootstrap lazy.nvim, LazyVim and your plugins - require("config.lazy") - - vim.g.editorconfig = true - - vim.opt.runtimepath:append ("${treesitter-parsers}") - ''; - plugins = [ - treesitterWithGrammars - ]; - extraPackages = with pkgs; [ - nil - nixpkgs-fmt - rustup - lua-language-server - ]; - withNodeJs = true; - withPython3 = true; - withRuby = true; - }; # Let Home Manager install and manage itself. programs.home-manager.enable = true; diff --git a/home/modules/neovim.nix b/home/modules/neovim.nix new file mode 100644 index 0000000..36a0d11 --- /dev/null +++ b/home/modules/neovim.nix @@ -0,0 +1,55 @@ +{ pkgs, lib, config, ... }: +let + cfg = config.snowhawk.neovim; +in +{ + options.snowhawk.neovim = { + enable = lib.mkEnableOption "neovim"; + package = lib.mkPackageOption pkgs "neovim" { + default = [ "neovim-unwrapped" ]; + }; + # package = lib.mkOption { + # type = lib.types.package; + # default = pkgs.neovim-unwrapped; + # defaultText = lib.literalExpression "pkgs.neovim-unwrapped"; + # description = "The package to use for the neovim binary."; + # }; + }; + config = lib.mkIf cfg.enable { + programs.neovim = + let + nvim-treesitter = pkgs.vimPlugins.nvim-treesitter; + treesitterWithGrammars = (nvim-treesitter.withPlugins (_: nvim-treesitter.allGrammars)); + + treesitter-parsers = pkgs.symlinkJoin { + name = "treesitter-parsers"; + paths = treesitterWithGrammars.dependencies; + }; + in + { + enable = true; + coc.enable = false; + package = cfg.package; + extraLuaConfig = '' + -- bootstrap lazy.nvim, LazyVim and your plugins + require("config.lazy") + + vim.g.editorconfig = true + + vim.opt.runtimepath:append ("${treesitter-parsers}") + ''; + plugins = [ + treesitterWithGrammars + ]; + extraPackages = with pkgs; [ + nil + nixpkgs-fmt + rustup + lua-language-server + ]; + withNodeJs = true; + withPython3 = true; + withRuby = true; + }; + }; +}