From b049b797a4d7d9fb5861b98ca14e63e32c64b536 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Thu, 6 Feb 2025 17:43:54 +0300 Subject: [PATCH] yeehaw --- flake.nix | 2 +- lib/default.nix | 5 ++-- lib/stdlib-extended.nix | 8 ++++-- lib/types/default.nix | 3 ++- lib/types/plugins.nix | 10 +++---- modules/default.nix | 3 ++- modules/plugins/lsp/lsp-signature/config.nix | 2 +- modules/plugins/lsp/null-ls/config.nix | 2 +- modules/plugins/lsp/trouble/config.nix | 2 +- .../plugins/notes/todo-comments/config.nix | 2 +- modules/plugins/statusline/lualine/config.nix | 2 +- modules/plugins/ui/smartcolumn/config.nix | 2 +- .../utility/binds/which-key/config.nix | 2 +- modules/plugins/utility/telescope/config.nix | 2 +- .../plugins/visuals/highlight-undo/config.nix | 2 +- .../visuals/indent-blankline/config.nix | 2 +- modules/wrapper/build/config.nix | 9 ++++--- npins/sources.json | 27 ++++++++++--------- 18 files changed, 48 insertions(+), 39 deletions(-) diff --git a/flake.nix b/flake.nix index ea878785..22b59422 100644 --- a/flake.nix +++ b/flake.nix @@ -7,7 +7,7 @@ } @ inputs: let # call the extended library with `inputs` # inputs is used to get the original standard library, and to pass inputs to the plugin autodiscovery function - lib = import ./lib/stdlib-extended.nix inputs; + lib = import ./lib/stdlib-extended.nix {inherit inputs self;}; in flake-parts.lib.mkFlake { inherit inputs; diff --git a/lib/default.nix b/lib/default.nix index e6ccd2a7..760a5b11 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,9 +1,10 @@ { + self, inputs, lib, ... }: { - types = import ./types {inherit inputs lib;}; + types = import ./types {inherit self inputs lib;}; config = import ./config.nix {inherit lib;}; binds = import ./binds.nix {inherit lib;}; @@ -12,5 +13,5 @@ lists = import ./lists.nix {inherit lib;}; attrsets = import ./attrsets.nix {inherit lib;}; lua = import ./lua.nix {inherit lib;}; - neovimConfiguration = import ../modules {inherit inputs lib;}; + neovimConfiguration = import ../modules {inherit self inputs lib;}; } diff --git a/lib/stdlib-extended.nix b/lib/stdlib-extended.nix index 0f30815a..a85160c3 100644 --- a/lib/stdlib-extended.nix +++ b/lib/stdlib-extended.nix @@ -1,6 +1,10 @@ # Convenience function that returns the given Nixpkgs standard library # extended with our functions using `lib.extend`. -inputs: +{ + inputs, + self, + ... +} @ args: inputs.nixpkgs.lib.extend (self: super: { # WARNING: New functions should not be added here, but to files # imported by `./default.nix` under their own categories. If your @@ -12,7 +16,7 @@ inputs.nixpkgs.lib.extend (self: super: { # E.g. for an input called `nvf`, `inputs.nvf.lib.nvim` will return the set # below. nvim = import ./. { - inherit inputs; + inherit (args) inputs self; lib = self; }; diff --git a/lib/types/default.nix b/lib/types/default.nix index c1c16715..20345dc9 100644 --- a/lib/types/default.nix +++ b/lib/types/default.nix @@ -1,10 +1,11 @@ { + self, inputs, lib, ... }: let typesDag = import ./dag.nix {inherit lib;}; - typesPlugin = import ./plugins.nix {inherit inputs lib;}; + typesPlugin = import ./plugins.nix {inherit self inputs lib;}; typesLanguage = import ./languages.nix {inherit lib;}; customTypes = import ./custom.nix {inherit lib;}; in { diff --git a/lib/types/plugins.nix b/lib/types/plugins.nix index 656b7ab8..be4c2646 100644 --- a/lib/types/plugins.nix +++ b/lib/types/plugins.nix @@ -1,12 +1,13 @@ { + self, inputs, lib, ... }: let inherit (lib.options) mkOption; inherit (lib.attrsets) attrNames mapAttrs' filterAttrs nameValuePair; - inherit (lib.strings) hasPrefix removePrefix; - inherit (lib.types) submodule either package enum str lines attrsOf anything listOf nullOr; + inherit (lib.strings) hasPrefix removePrefix replaceStrings toLower; + inherit (lib.types) submodule either package enum str lines anything listOf nullOr; # Get the names of all flake inputs that start with the given prefix. fromInputs = { @@ -16,10 +17,7 @@ mapAttrs' (n: v: nameValuePair (removePrefix prefix n) {src = v;}) (filterAttrs (n: _: hasPrefix prefix n) inputs); # Get the names of all flake inputs that start with the given prefix. - pluginInputNames = attrNames (fromInputs { - inherit inputs; - prefix = "plugin-"; - }); + pluginInputNames = map (pin: replaceStrings ["." "_"] ["-" "-"] (toLower pin)) (attrNames self.pins); # You can either use the name of the plugin or a package. pluginType = nullOr ( diff --git a/modules/default.nix b/modules/default.nix index a207e0d1..a479bae2 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,4 +1,5 @@ { + self, inputs, lib, }: { @@ -23,7 +24,7 @@ specialArgs = extraSpecialArgs // { - inherit inputs; + inherit self inputs; modulesPath = toString ./.; }; modules = concatLists [ diff --git a/modules/plugins/lsp/lsp-signature/config.nix b/modules/plugins/lsp/lsp-signature/config.nix index c9940534..4bb0ed95 100644 --- a/modules/plugins/lsp/lsp-signature/config.nix +++ b/modules/plugins/lsp/lsp-signature/config.nix @@ -12,7 +12,7 @@ in { config = mkIf (cfg.enable && cfg.lspSignature.enable) { vim = { startPlugins = [ - "lsp-signature" + "lsp-signature-nvim" ]; lsp.lspSignature.setupOpts = { diff --git a/modules/plugins/lsp/null-ls/config.nix b/modules/plugins/lsp/null-ls/config.nix index 8e776ed3..549ef0b7 100644 --- a/modules/plugins/lsp/null-ls/config.nix +++ b/modules/plugins/lsp/null-ls/config.nix @@ -14,7 +14,7 @@ in { { vim = { startPlugins = [ - "none-ls" + "none-ls-nvim" "plenary-nvim" ]; diff --git a/modules/plugins/lsp/trouble/config.nix b/modules/plugins/lsp/trouble/config.nix index c41dec60..27453316 100644 --- a/modules/plugins/lsp/trouble/config.nix +++ b/modules/plugins/lsp/trouble/config.nix @@ -14,7 +14,7 @@ in { config = mkIf (cfg.enable && cfg.trouble.enable) { vim = { lazy.plugins.trouble = { - package = "trouble"; + package = "trouble-nvim"; setupModule = "trouble"; inherit (cfg.trouble) setupOpts; diff --git a/modules/plugins/notes/todo-comments/config.nix b/modules/plugins/notes/todo-comments/config.nix index 645f6770..b03efce4 100644 --- a/modules/plugins/notes/todo-comments/config.nix +++ b/modules/plugins/notes/todo-comments/config.nix @@ -15,7 +15,7 @@ in { config = mkIf cfg.enable { vim = { startPlugins = [ - "todo-comments" + "todo-comments-nvim" ]; maps.normal = mkMerge [ diff --git a/modules/plugins/statusline/lualine/config.nix b/modules/plugins/statusline/lualine/config.nix index ac587c03..facfcebb 100644 --- a/modules/plugins/statusline/lualine/config.nix +++ b/modules/plugins/statusline/lualine/config.nix @@ -34,7 +34,7 @@ in { }) (mkIf cfg.enable { vim = { - startPlugins = ["lualine"]; + startPlugins = ["lualine-nvim"]; pluginRC.lualine = entryAnywhere '' local lualine = require('lualine') lualine.setup ${toLuaObject cfg.setupOpts} diff --git a/modules/plugins/ui/smartcolumn/config.nix b/modules/plugins/ui/smartcolumn/config.nix index f38edfdf..9f6f10e2 100644 --- a/modules/plugins/ui/smartcolumn/config.nix +++ b/modules/plugins/ui/smartcolumn/config.nix @@ -11,7 +11,7 @@ in { config = mkIf cfg.enable { vim = { - startPlugins = ["smartcolumn"]; + startPlugins = ["smartcolumn-nvim"]; pluginRC.smartcolumn = entryAnywhere '' require("smartcolumn").setup(${toLuaObject cfg.setupOpts}) diff --git a/modules/plugins/utility/binds/which-key/config.nix b/modules/plugins/utility/binds/which-key/config.nix index 01a29fbf..68dbbfbf 100644 --- a/modules/plugins/utility/binds/which-key/config.nix +++ b/modules/plugins/utility/binds/which-key/config.nix @@ -14,7 +14,7 @@ in { config = mkIf cfg.enable { vim = { - startPlugins = ["which-key"]; + startPlugins = ["which-key-nvim"]; pluginRC.whichkey = entryAnywhere '' local wk = require("which-key") diff --git a/modules/plugins/utility/telescope/config.nix b/modules/plugins/utility/telescope/config.nix index 95f81327..e2ba56f8 100644 --- a/modules/plugins/utility/telescope/config.nix +++ b/modules/plugins/utility/telescope/config.nix @@ -19,7 +19,7 @@ in { startPlugins = ["plenary-nvim"]; lazy.plugins.telescope = { - package = "telescope"; + package = "telescope-nvim"; setupModule = "telescope"; inherit (cfg) setupOpts; diff --git a/modules/plugins/visuals/highlight-undo/config.nix b/modules/plugins/visuals/highlight-undo/config.nix index d41c6a69..09ae49be 100644 --- a/modules/plugins/visuals/highlight-undo/config.nix +++ b/modules/plugins/visuals/highlight-undo/config.nix @@ -11,7 +11,7 @@ in { config = mkIf cfg.enable { vim = { - startPlugins = ["highlight-undo"]; + startPlugins = ["highlight-undo-nvim"]; pluginRC.highlight-undo = entryAnywhere '' require("highlight-undo").setup(${toLuaObject cfg.setupOpts}) diff --git a/modules/plugins/visuals/indent-blankline/config.nix b/modules/plugins/visuals/indent-blankline/config.nix index 581bd136..78ebf68c 100644 --- a/modules/plugins/visuals/indent-blankline/config.nix +++ b/modules/plugins/visuals/indent-blankline/config.nix @@ -11,7 +11,7 @@ in { config = mkIf cfg.enable { vim = { - startPlugins = ["indent-blankline"]; + startPlugins = ["indent-blankline-nvim"]; pluginRC.indent-blankline = entryAnywhere '' require("ibl").setup(${toLuaObject cfg.setupOpts}) diff --git a/modules/wrapper/build/config.nix b/modules/wrapper/build/config.nix index 46d99b36..86dfd428 100644 --- a/modules/wrapper/build/config.nix +++ b/modules/wrapper/build/config.nix @@ -1,8 +1,9 @@ { + self, inputs, - lib, config, pkgs, + lib, ... } : let @@ -15,15 +16,15 @@ vimOptions = config.vim; noBuildPlug = pname: let - input = inputs."plugin-${pname}"; - version = input.shortRev or input.shortDirtyRev or "dirty"; + pin = self.pins.${pname}; + version = pin.revision or "dirty"; in { # vim.lazy.plugins relies on pname, so we only set that here # version isn't needed for anything, but inherit it anyway for correctness inherit pname version; outPath = path { name = "${pname}-0-unstable-${version}"; - path = input.outPath; + path = pin.outPath; }; passthru.vimPlugin = false; }; diff --git a/npins/sources.json b/npins/sources.json index b201e331..8a261d5e 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -84,6 +84,21 @@ "url": "https://github.com/famiu/bufdelete.nvim/archive/f6bcea78afb3060b198125256f897040538bcb81.tar.gz", "hash": "0xfzk3zgnxbwnr55n3lglsb8nmhnchpiqz9d152xr6j8d9z0sdcn" }, + "catppuccin": { + "type": "GitRelease", + "repository": { + "type": "GitHub", + "owner": "catppuccin", + "repo": "nvim" + }, + "pre_releases": false, + "version_upper_bound": null, + "release_prefix": null, + "version": "v1.9.0", + "revision": "c9e205fe035d622b3c2d66ee42edf368c0c31fd5", + "url": "https://api.github.com/repos/catppuccin/nvim/tarball/v1.9.0", + "hash": "1y5f1fj672q8drr06q6w8yhwrqzp0265jb2gmr0ql8m3hd1v0sj0" + }, "ccc.nvim": { "type": "Git", "repository": { @@ -1266,18 +1281,6 @@ "url": "https://github.com/MunifTanjim/nui.nvim/archive/53e907ffe5eedebdca1cd503b00aa8692068ca46.tar.gz", "hash": "1m4vlf9qcs01a8qrq3salcz966sp8cpf01gbrg8dbf255vzc8kp9" }, - "nvim": { - "type": "Git", - "repository": { - "type": "GitHub", - "owner": "catppuccin", - "repo": "nvim" - }, - "branch": "main", - "revision": "f67b886d65a029f12ffa298701fb8f1efd89295d", - "url": "https://github.com/catppuccin/nvim/archive/f67b886d65a029f12ffa298701fb8f1efd89295d.tar.gz", - "hash": "0fwgsvlxvzz5r8jfmj1fp97cqv9b9h2f37fn4nhmim5lm6d0n14p" - }, "nvim-autopairs": { "type": "Git", "repository": {