From a8f972701c9009a3a22e75a35da5b9826bf8c50b Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 1 Mar 2023 12:08:24 +0300 Subject: [PATCH] feat: add diffview.nvim to inputs --- extra.nix | 1 + flake.lock | 17 +++++++++++++++++ flake.nix | 5 +++++ lib/types-plugin.nix | 1 + modules/utility/default.nix | 1 + modules/utility/diffview/config.nix | 21 +++++++++++++++++++++ modules/utility/diffview/default.nix | 6 ++++++ modules/utility/diffview/diffview.nix | 14 ++++++++++++++ 8 files changed, 66 insertions(+) create mode 100644 modules/utility/diffview/config.nix create mode 100644 modules/utility/diffview/default.nix create mode 100644 modules/utility/diffview/diffview.nix diff --git a/extra.nix b/extra.nix index 1c4e661..2d543ef 100644 --- a/extra.nix +++ b/extra.nix @@ -140,6 +140,7 @@ inputs: let colorizer.enable = true; icon-picker.enable = true; venn-nvim.enable = false; # FIXME throws an error when its commands are ran manually + diffview-nvim.enable = true; }; vim.notes = { diff --git a/flake.lock b/flake.lock index 974ba4c..937b391 100644 --- a/flake.lock +++ b/flake.lock @@ -272,6 +272,22 @@ "type": "github" } }, + "diffview-nvim": { + "flake": false, + "locked": { + "lastModified": 1677593773, + "narHash": "sha256-CMURShXn0RjZW3dc96o1usaLwWC+gOPAkIn3D9YPyBg=", + "owner": "sindrets", + "repo": "diffview.nvim", + "rev": "009beb8054e510e7e2df122ee3ddb2b46bef542b", + "type": "github" + }, + "original": { + "owner": "sindrets", + "repo": "diffview.nvim", + "type": "github" + } + }, "dirt-samples-src": { "flake": false, "locked": { @@ -1235,6 +1251,7 @@ "copilot-lua": "copilot-lua", "crates-nvim": "crates-nvim", "dashboard-nvim": "dashboard-nvim", + "diffview-nvim": "diffview-nvim", "dressing-nvim": "dressing-nvim", "fidget-nvim": "fidget-nvim", "flake-parts": "flake-parts", diff --git a/flake.nix b/flake.nix index 7736d8a..b5c9120 100644 --- a/flake.nix +++ b/flake.nix @@ -345,6 +345,11 @@ flake = false; }; + diffview-nvim = { + url = "github:sindrets/diffview.nvim"; + flake = false; + }; + venn-nvim = { url = "github:jbyuki/venn.nvim"; flake = false; diff --git a/lib/types-plugin.nix b/lib/types-plugin.nix index 7e863f8..aa060f4 100644 --- a/lib/types-plugin.nix +++ b/lib/types-plugin.nix @@ -70,6 +70,7 @@ with lib; let "kommentary" "mind-nvim" "fidget-nvim" + "diffview-nvim" ]; # You can either use the name of the plugin or a package. pluginsType = with types; listOf (nullOr (either (enum availablePlugins) package)); diff --git a/modules/utility/default.nix b/modules/utility/default.nix index 347e4d7..f2f0e2f 100644 --- a/modules/utility/default.nix +++ b/modules/utility/default.nix @@ -7,5 +7,6 @@ _: { ./icon-picker ./telescope ./venn + ./diffview ]; } diff --git a/modules/utility/diffview/config.nix b/modules/utility/diffview/config.nix new file mode 100644 index 0000000..6b81ee4 --- /dev/null +++ b/modules/utility/diffview/config.nix @@ -0,0 +1,21 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.utility.diffview-nvim; +in { + config = mkIf (cfg.enable) { + vim.startPlugins = [ + "diffview-nvim" + "plenary-nvim" + ]; + + vim.luaConfigRC.diffview-nvim = + nvim.dag.entryAnywhere '' + ''; + }; +} diff --git a/modules/utility/diffview/default.nix b/modules/utility/diffview/default.nix new file mode 100644 index 0000000..4cb468b --- /dev/null +++ b/modules/utility/diffview/default.nix @@ -0,0 +1,6 @@ +_: { + imports = [ + ./config.nix + ./diffview.nix + ]; +} diff --git a/modules/utility/diffview/diffview.nix b/modules/utility/diffview/diffview.nix new file mode 100644 index 0000000..13d876f --- /dev/null +++ b/modules/utility/diffview/diffview.nix @@ -0,0 +1,14 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.utility.diffview-nvim; +in { + options.vim.utility.diffview-nvim = { + enable = mkEnableOption "Enable diffview-nvim"; + }; +}