diff options
| -rw-r--r-- | flake.lock | 21 | ||||
| -rw-r--r-- | flake.nix | 5 | ||||
| -rw-r--r-- | home-manager/default.nix | 1 | ||||
| -rw-r--r-- | home-manager/neovim.nix | 108 | ||||
| -rw-r--r-- | users/timmy/home.nix | 2 |
5 files changed, 27 insertions, 110 deletions
@@ -81,6 +81,26 @@ "type": "github" } }, + "neovim-vanilla-wrapped": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1785545076, + "narHash": "sha256-lT+lWgPVjkzVumhy9eS4dJULIf/zuOlyQySzj3DVSfY=", + "ref": "refs/heads/master", + "rev": "07ad5b45941fa3e33a70270592815fa317a14c19", + "revCount": 3, + "type": "git", + "url": "git://git.tjkeller.xyz/neovim-vanilla-wrapped" + }, + "original": { + "type": "git", + "url": "git://git.tjkeller.xyz/neovim-vanilla-wrapped" + } + }, "nixpkgs": { "locked": { "lastModified": 1785386831, @@ -183,6 +203,7 @@ "inputs": { "arkenfox": "arkenfox", "home-manager": "home-manager", + "neovim-vanilla-wrapped": "neovim-vanilla-wrapped", "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable", "open-bamboo-networking": "open-bamboo-networking", @@ -25,6 +25,10 @@ rec { url = "git://git.tjkeller.xyz/open-bamboo-network-plugin-flake"; inputs.nixpkgs.follows = "nixpkgs"; }; + neovim-vanilla-wrapped = { + url = "git://git.tjkeller.xyz/neovim-vanilla-wrapped"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { nixpkgs, home-manager, ... }@inputs: let @@ -34,6 +38,7 @@ rec { inputs.arkenfox.hmModules.arkenfox inputs.reposync.hmModules.reposync inputs.open-bamboo-networking.hmModules.open-bamboo-networking + inputs.neovim-vanilla-wrapped.hmModules.neovim-vanilla-wrapped ./home-manager ]; mkNixosConfiguration = system: hostname: nixpkgs.lib.nixosSystem { diff --git a/home-manager/default.nix b/home-manager/default.nix index 8d9c722..226552a 100644 --- a/home-manager/default.nix +++ b/home-manager/default.nix @@ -6,7 +6,6 @@ ./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 deleted file mode 100644 index 6bb13d7..0000000 --- a/home-manager/neovim.nix +++ /dev/null @@ -1,108 +0,0 @@ -{ lib, config, pkgs, ... }: let - cfg = config.programs._neovim; - - pluginDir = let - extraPlugins = cfg.plugins.packages // { - start = (cfg.plugins.packages.start or []) - ++ lib.optionals (cfg.plugins.lsp.enable && cfg.plugins.lsp.lspconfig.enable) [ cfg.plugins.lsp.lspconfig.pluginPackage ] - ++ lib.optionals cfg.plugins.treesitter.enable [ cfg.plugins.treesitter.pluginPackage ]; - }; - in 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 = pkgs.symlinkJoin { - name = "nvim-extra-packages"; - paths = cfg.extraPackages - ++ lib.optionals cfg.plugins.lsp.enable cfg.plugins.lsp.languageServers.packages; - }; - - parserDir = let - allTSParserPackages = builtins.filter lib.isDerivation - (builtins.attrValues cfg.plugins.treesitter.parsers.installAllFromPackageSet); - in pkgs.symlinkJoin { - name = "nvim-treesitter-parsers"; - paths = if cfg.plugins.treesitter.parsers.installAll then allTSParserPackages else cfg.plugins.treesitter.parsers.packages; - }; - - finalPackage = pkgs.symlinkJoin { - name = "neovim-not-wrapped"; - paths = [ cfg.package ]; - nativeBuildInputs = [ pkgs.makeWrapper ]; - postBuild = '' - wrapProgram $out/bin/nvim \ - --prefix PATH : ${extraPackages}/bin \ - --prefix XDG_DATA_DIRS : ${pluginDir}/share \ - '' + lib.optionalString cfg.plugins.treesitter.enable '' - --add-flags '--cmd "set rtp^=${parserDir}"' \ - --add-flags '--cmd "set rtp^=${cfg.plugins.treesitter.pluginPackage}/runtime"' \ - '' + '' - # blank line here to terminate multiline command string - '' + 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"; - lspconfig = { - enable = lib.mkEnableOption "install plugin `lspconfig.pluginPackage`"; - 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.installAll = lib.mkEnableOption "install all available parsers. overrides `parsers.packages`"; - parsers.installAllFromPackageSet = lib.mkOption { - type = lib.types.attrsOf lib.types.anything; - default = pkgs.vimPlugins.nvim-treesitter-parsers; - defaultText = lib.literalExpression "pkgs.vimPlugins.nvim-treesitter-parsers"; - description = "parent package from which to install all treesitter parsers"; - }; - 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/users/timmy/home.nix b/users/timmy/home.nix index 8b082c2..2957620 100644 --- a/users/timmy/home.nix +++ b/users/timmy/home.nix @@ -66,7 +66,7 @@ in { in bookmarksUserDirs; # Setup neovim - programs._neovim = { + programs.neovim-vanilla = { enable = true; viAlias = true; vimAlias = true; |
