{ pkgs, lib, config, inputs, ... }: let cfg = config.snowhawk.neovim; nightlyPackage = inputs.neovim-overlay.packages.${pkgs.system}.default; in { options.snowhawk.neovim = { enable = lib.mkEnableOption "neovim home-manager module"; nightly = lib.mkEnableOption "nightly build of neovim"; package = lib.mkPackageOption pkgs "neovim" { default = [ "neovim-unwrapped" ]; }; # This should be close to identical to above # # 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 = 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 lib.mkIf cfg.enable { snowhawk.neovim.package = lib.mkIf cfg.nightly (lib.mkDefault nightlyPackage); # Set nvim as manpager and default editor home.sessionVariables = { EDITOR = "nvim"; MANPAGER = "nvim +Man!"; }; xdg.configFile."nvim/lua/parsers.lua".text = /* lua */ '' vim.opt.runtimepath:append ("${treesitter-parsers}") ''; programs.neovim = { enable = true; coc.enable = false; package = cfg.package; withNodeJs = true; withPython3 = true; withRuby = true; plugins = [ treesitterWithGrammars ]; extraPackages = with pkgs; [ nil nixpkgs-fmt rustup lua-language-server fzf ]; }; }; }