summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Keller <tjk@tjkeller.xyz>2026-05-21 22:48:23 -0500
committerTim Keller <tjk@tjkeller.xyz>2026-05-21 22:48:23 -0500
commit6055a9d94861e865ed293c7babd033e30777b002 (patch)
treee580e17aab102e93b487e332c44220645f22bc3a
parent4e4ec16117af9dbf1043e8b9e82e908e0efbfa75 (diff)
downloadnixos-master.tar.xz
nixos-master.zip
neovim native plugins and entire hm config section for nvimHEADstandalone-homemaster
-rw-r--r--archetypes/collections/neovim.nix13
-rw-r--r--home-manager/default.nix1
-rw-r--r--home-manager/neovim.nix82
-rw-r--r--pkgs/default.nix6
-rw-r--r--pkgs/vimPlugins/overrides.nix46
-rw-r--r--users/timmy/home.nix46
6 files changed, 180 insertions, 14 deletions
diff --git a/archetypes/collections/neovim.nix b/archetypes/collections/neovim.nix
index 16941d4..2040d77 100644
--- a/archetypes/collections/neovim.nix
+++ b/archetypes/collections/neovim.nix
@@ -1,5 +1,5 @@
{ lib, pkgs, ... }: let
- cfg.neovimPackage = pkgs.neovim;
+ cfg.neovimPackage = pkgs.unstable.neovim;
# Neovim package that includes aliases vi(m) -> nvim
neovim-aliases = pkgs.symlinkJoin {
@@ -11,17 +11,8 @@
'';
};
in {
- # Don't use programs.neovim since that will build neovim from source
+ # NOTE: Don't use programs.neovim since that will build neovim from source
environment.systemPackages = with pkgs; [
neovim-aliases
- # TODO should make the following available to nvim only, not system path
- # LSP servers
- python313Packages.python-lsp-server
- svelte-language-server
- tailwindcss-language-server
- vscode-langservers-extracted
- # Misc deps
- gcc # Treesitter requires a C compiler
- unzip # For zip, xlsx, etc. files
];
}
diff --git a/home-manager/default.nix b/home-manager/default.nix
index 226552a..8d9c722 100644
--- a/home-manager/default.nix
+++ b/home-manager/default.nix
@@ -6,6 +6,7 @@
./home-cleanup.nix
./htop.nix
./mint-theme.nix
+ ./neovim.nix
./pcmanfm.nix
./qt-gtk-theme.nix
./theme-st.nix
diff --git a/home-manager/neovim.nix b/home-manager/neovim.nix
new file mode 100644
index 0000000..60608f6
--- /dev/null
+++ b/home-manager/neovim.nix
@@ -0,0 +1,82 @@
+{ lib, config, pkgs, ... }: let
+ cfg = config.programs._neovim;
+
+ extraPlugins = cfg.plugins.packages // {
+ start = (cfg.plugins.packages.start or [])
+ ++ lib.optionals cfg.plugins.lsp.enable [ cfg.plugins.lsp.pluginPackage ]
+ ++ lib.optionals cfg.plugins.treesitter.enable [ cfg.plugins.treesitter.pluginPackage ]
+ ++ lib.optionals cfg.plugins.treesitter.enable cfg.plugins.treesitter.parsers.packages;
+ };
+ pluginDir = pkgs.linkFarm "nvim-site"
+ (lib.concatLists (lib.mapAttrsToList (stage: plugins:
+ map (plugin: {
+ name = "share/nvim/site/pack/plugins/${stage}/${plugin.name}";
+ path = plugin;
+ }) plugins
+ ) extraPlugins));
+
+ extraPackages = cfg.extraPackages
+ ++ lib.optionals cfg.plugins.lsp.enable cfg.plugins.lsp.languageServers.packages;
+
+ finalPackage = pkgs.symlinkJoin {
+ name = "neovim-not-wrapped";
+ paths = [ cfg.package ];
+ nativeBuildInputs = [ pkgs.makeWrapper ];
+ postBuild = ''
+ wrapProgram $out/bin/nvim \
+ --prefix PATH : ${pkgs.lib.makeBinPath extraPackages} \
+ --prefix XDG_DATA_DIRS : ${pluginDir}/share
+ '' + lib.optionalString cfg.viAlias ''
+ ln -s $out/bin/nvim $out/bin/vi
+ '' + lib.optionalString cfg.vimAlias ''
+ ln -s $out/bin/nvim $out/bin/vim
+ '';
+ };
+in {
+ options.programs._neovim = {
+ enable = lib.mkEnableOption "install and configure neovim";
+ package = lib.mkPackageOption pkgs "neovim" {};
+ viAlias = lib.mkEnableOption "alias vi => nvim";
+ vimAlias = lib.mkEnableOption "alias vim => nvim";
+ plugins = {
+ lsp = {
+ enable = lib.mkEnableOption "install defined language servers into nvim path";
+ pluginPackage = lib.mkPackageOption pkgs.vimPlugins "nvim-lspconfig" {};
+ languageServers.packages = lib.mkOption {
+ type = lib.types.listOf lib.types.package;
+ default = [ ];
+ description = "language server packages to add to nvim path when lsp is enabled";
+ };
+ };
+ treesitter = {
+ enable = lib.mkEnableOption "install treesitter and parsers as nvim plugins";
+ pluginPackage = lib.mkPackageOption pkgs.vimPlugins "nvim-treesitter" {};
+ parsers.packages = lib.mkOption {
+ type = lib.types.listOf lib.types.package;
+ default = [ ];
+ description = "treesitter parsers to install as plugins";
+ };
+ };
+ packages = lib.mkOption {
+ type = lib.types.attrsOf (lib.types.listOf lib.types.package);
+ default = [ ];
+ example = {
+ start = with pkgs.vimPlugins; [
+ nvim-colorizer-lua
+ ];
+ };
+ description = "extra plugins to be made available to nvim via packpath, organized by stage";
+ };
+ };
+ extraPackages = lib.mkOption {
+ type = lib.types.listOf lib.types.package;
+ default = [ ];
+ description = "extra packages to add to nvim path";
+ };
+ };
+
+ config = lib.mkIf cfg.enable {
+ # NOTE: Don't use programs.neovim since that will build neovim from source
+ home.packages = [ finalPackage ];
+ };
+}
diff --git a/pkgs/default.nix b/pkgs/default.nix
index fb76338..1de13ff 100644
--- a/pkgs/default.nix
+++ b/pkgs/default.nix
@@ -1,8 +1,8 @@
{ pkgs, inputs, ... }: {
nixpkgs.overlays = with pkgs; [
(final: prev: {
- immich-frame = (callPackage ./immich-frame {});
- lowbat = (callPackage ./lowbat {});
+ immich-frame = (callPackage ./immich-frame {});
+ lowbat = (callPackage ./lowbat {});
workcentre-7800-series = (callPackage ./xerox-workcentre-7800-series-driver {});
unclutter-desktop-entry = (callPackage ./unclutter-desktop-entry {});
@@ -26,7 +26,9 @@
};
});
})
+ # Import overlays
(import ./st/overrides.nix)
+ (import ./vimPlugins/overrides.nix)
(import ./xorg/overrides.nix)
# Allow installing unstable packages via pkgs.unstable.<name>
(final: prev: {
diff --git a/pkgs/vimPlugins/overrides.nix b/pkgs/vimPlugins/overrides.nix
new file mode 100644
index 0000000..a56511b
--- /dev/null
+++ b/pkgs/vimPlugins/overrides.nix
@@ -0,0 +1,46 @@
+final: prev: {
+ vimPlugins = prev.vimPlugins // {
+ minitab-nvim = prev.vimUtils.buildVimPlugin rec {
+ pname = "minitab.nvim";
+ version = "2024-11-28";
+ rev = "f6183e8cb6f408e54dd5d1d13c0075376655a3ec";
+ src = prev.fetchzip {
+ url = "https://git.tjkeller.xyz/${pname}/snapshot/${pname}-${rev}.tar.xz";
+ sha256 = "sha256-INJC+6GNTF5MpvtOh6/eYD5CMiXxlP6aHT5TX2lJqiM=";
+ };
+ meta.homepage = "https://git.tjkeller.xyz/minitab.nvim";
+ };
+
+ # TODO
+ #nvim-treesitter-parsers = prev.vimPlugins.nvim-treesitter-parsers // {
+ # #jinja2 = prev.tree-sitter.buildGrammar rec {
+ # # language = "jinja2";
+ # # version = "2025-10-24";
+ # # src = prev.fetchFromGitHub {
+ # # owner = "geigerzaehler";
+ # # repo = "tree-sitter-jinja2";
+ # # rev = "ecab6215c53da5c1126d81d1bf664b3b5cf87d15";
+ # # sha256 = "sha256-gYU9gQZMlLKYHVAISa5AF/KXzr0PA0M8gK0/B7gXcYs=";
+ # # };
+ # # meta.homepage = "https://github.com/geigerzaehler/tree-sitter-jinja2";
+ # #};
+ # #jinja2 = prev.vimUtils.buildVimPlugin rec {
+ # # pname = "jinja2";
+ # # version = "2025-10-24";
+ # # src = prev.fetchFromGitHub {
+ # # owner = "geigerzaehler";
+ # # repo = "tree-sitter-jinja2";
+ # # rev = "ecab6215c53da5c1126d81d1bf664b3b5cf87d15";
+ # # sha256 = "sha256-gYU9gQZMlLKYHVAISa5AF/KXzr0PA0M8gK0/B7gXcYs=";
+ # # };
+ # # patches = [
+ # # (prev.fetchpatch {
+ # # url = "https://github.com/geigerzaehler/tree-sitter-jinja2/pull/6.diff";
+ # # sha256 = "sha256-CBUAwb9hz1Cpa4RaY+6aTMJNU+hX9D3BGpNxL+MoAq0=";
+ # # })
+ # # ];
+ # # meta.homepage = "https://github.com/geigerzaehler/tree-sitter-jinja2";
+ # #};
+ #};
+ };
+}
diff --git a/users/timmy/home.nix b/users/timmy/home.nix
index cb99456..77934bc 100644
--- a/users/timmy/home.nix
+++ b/users/timmy/home.nix
@@ -1,4 +1,4 @@
-{ lib, config, ... }: let
+{ lib, pkgs, config, ... }: let
cfg = config._users.${username}.home;
username = "timmy";
email = "tjk@tjkeller.xyz";
@@ -19,6 +19,9 @@
in {
options._users.${username}.home = {
enable = lib.mkEnableOption "configure home for user ${username}";
+ #neovim = {
+ # enableLSP = lib.mkEnableOption "whether to enable lsp";
+ #};
};
config = lib.mkIf cfg.enable {
@@ -61,5 +64,46 @@ in {
lib.mkIf (dir != null) "file://${dir} ${lib.toUpper (lib.substring 0 1 name)}${lib.substring 1 (-1) name}" # Make first letter upper case
) userDirs
);
+
+ # Setup neovim
+ programs._neovim = {
+ enable = true;
+ package = pkgs.unstable.neovim;
+ viAlias = true;
+ vimAlias = true;
+ plugins = {
+ lsp = {
+ enable = lib.mkDefault true;
+ languageServers.packages = with pkgs; [
+ python313Packages.python-lsp-server
+ svelte-language-server
+ tailwindcss-language-server
+ typescript-language-server
+ vscode-langservers-extracted
+ ];
+ };
+ treesitter = let
+ allTSParserPackages = builtins.filter lib.isDerivation
+ (builtins.attrValues pkgs.vimPlugins.nvim-treesitter-parsers);
+ in {
+ enable = lib.mkDefault true;
+ parsers.packages = allTSParserPackages;
+ };
+ packages.start = with pkgs.vimPlugins; [
+ autoclose-nvim
+ blink-cmp
+ gruvbox-nvim
+ minitab-nvim
+ nvim-colorizer-lua
+ nvim-ts-autotag # depends on treesitter
+ pkgs.unstable.vimPlugins.rainbow-delimiters-nvim # depends on treesitter
+ snacks-nvim
+ ];
+ };
+ extraPackages = with pkgs; [
+ gcc # Treesitter requires a C compiler
+ unzip # For zip, xlsx, etc. files
+ ];
+ };
};
}