From f567b08e9238153ae011d172b503193370213725 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 27 Feb 2023 17:53:09 +0300 Subject: [PATCH] feat: apply new module format to dashboard plugins [3/3] --- modules/dashboard/alpha/alpha.nix | 14 +++++ .../dashboard/{alpha.nix => alpha/config.nix} | 9 ++-- modules/dashboard/alpha/default.nix | 6 +++ .../config.nix} | 4 -- .../dashboard-nvim/dashboard-nvim.nix | 14 +++++ modules/dashboard/dashboard-nvim/default.nix | 6 +++ modules/dashboard/default.nix | 6 +-- modules/dashboard/startify/config.nix | 54 +++++++++++++++++++ modules/dashboard/startify/default.nix | 6 +++ modules/dashboard/{ => startify}/startify.nix | 39 -------------- 10 files changed, 106 insertions(+), 52 deletions(-) create mode 100644 modules/dashboard/alpha/alpha.nix rename modules/dashboard/{alpha.nix => alpha/config.nix} (97%) create mode 100644 modules/dashboard/alpha/default.nix rename modules/dashboard/{dashboard-nvim.nix => dashboard-nvim/config.nix} (77%) create mode 100644 modules/dashboard/dashboard-nvim/dashboard-nvim.nix create mode 100644 modules/dashboard/dashboard-nvim/default.nix create mode 100644 modules/dashboard/startify/config.nix create mode 100644 modules/dashboard/startify/default.nix rename modules/dashboard/{ => startify}/startify.nix (75%) diff --git a/modules/dashboard/alpha/alpha.nix b/modules/dashboard/alpha/alpha.nix new file mode 100644 index 0000000..c1101a7 --- /dev/null +++ b/modules/dashboard/alpha/alpha.nix @@ -0,0 +1,14 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.dashboard.alpha; +in { + options.vim.dashboard.alpha = { + enable = mkEnableOption "alpha"; + }; +} diff --git a/modules/dashboard/alpha.nix b/modules/dashboard/alpha/config.nix similarity index 97% rename from modules/dashboard/alpha.nix rename to modules/dashboard/alpha/config.nix index 833ccdf..c5053ad 100644 --- a/modules/dashboard/alpha.nix +++ b/modules/dashboard/alpha/config.nix @@ -8,17 +8,14 @@ with lib; with builtins; let cfg = config.vim.dashboard.alpha; in { - options.vim.dashboard.alpha = { - enable = mkEnableOption "alpha"; - }; - config = mkIf cfg.enable { vim.startPlugins = [ "alpha-nvim" + "nvim-web-devicons" ]; - # the credit for this configuration goes to https://github.com/Rishabh672003 - # good work, honestly + # the entire credit for this dashboard configuration to https://github.com/Rishabh672003 + # honestly, excellent work vim.luaConfigRC.alpha = nvim.dag.entryAnywhere '' local alpha = require("alpha") local plenary_path = require("plenary.path") diff --git a/modules/dashboard/alpha/default.nix b/modules/dashboard/alpha/default.nix new file mode 100644 index 0000000..16496c6 --- /dev/null +++ b/modules/dashboard/alpha/default.nix @@ -0,0 +1,6 @@ +_: { + imports = [ + ./alpha.nix + ./config.nix + ]; +} diff --git a/modules/dashboard/dashboard-nvim.nix b/modules/dashboard/dashboard-nvim/config.nix similarity index 77% rename from modules/dashboard/dashboard-nvim.nix rename to modules/dashboard/dashboard-nvim/config.nix index de7d2d6..e63399b 100644 --- a/modules/dashboard/dashboard-nvim.nix +++ b/modules/dashboard/dashboard-nvim/config.nix @@ -8,10 +8,6 @@ with lib; with builtins; let cfg = config.vim.dashboard.dashboard-nvim; in { - options.vim.dashboard.dashboard-nvim = { - enable = mkEnableOption "dashboard-nvim"; - }; - config = mkIf cfg.enable { vim.startPlugins = [ "dashboard-nvim" diff --git a/modules/dashboard/dashboard-nvim/dashboard-nvim.nix b/modules/dashboard/dashboard-nvim/dashboard-nvim.nix new file mode 100644 index 0000000..b62667e --- /dev/null +++ b/modules/dashboard/dashboard-nvim/dashboard-nvim.nix @@ -0,0 +1,14 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.dashboard.dashboard-nvim; +in { + options.vim.dashboard.dashboard-nvim = { + enable = mkEnableOption "dashboard-nvim"; + }; +} diff --git a/modules/dashboard/dashboard-nvim/default.nix b/modules/dashboard/dashboard-nvim/default.nix new file mode 100644 index 0000000..5bc4473 --- /dev/null +++ b/modules/dashboard/dashboard-nvim/default.nix @@ -0,0 +1,6 @@ +_: { + imports = [ + ./dashboard-nvim.nix + ./config.nix + ]; +} diff --git a/modules/dashboard/default.nix b/modules/dashboard/default.nix index bdee0db..0056f89 100644 --- a/modules/dashboard/default.nix +++ b/modules/dashboard/default.nix @@ -5,8 +5,8 @@ ... }: { imports = [ - ./alpha.nix - ./dashboard-nvim.nix - ./startify.nix + ./alpha + ./dashboard-nvim + ./startify ]; } diff --git a/modules/dashboard/startify/config.nix b/modules/dashboard/startify/config.nix new file mode 100644 index 0000000..c69d774 --- /dev/null +++ b/modules/dashboard/startify/config.nix @@ -0,0 +1,54 @@ +{ + pkgs, + config, + lib, + ... +}: +with builtins; +with lib; let + cfg = config.vim.dashboard.startify; + + mkVimBool = val: + if val + then "1" + else "0"; +in { + config = mkIf (cfg.enable) { + vim.startPlugins = with pkgs.neovimPlugins; [vim-startify]; + + vim.globals = { + "startify_custom_header" = + if cfg.customHeader == [] + then null + else cfg.customHeader; + "startify_custom_footer" = + if cfg.customFooter == [] + then null + else cfg.customFooter; + "startify_bookmarks" = cfg.bookmarks; + "startify_lists" = cfg.lists; + "startify_change_to_dir" = mkVimBool cfg.changeToDir; + "startify_change_to_vcs_root" = mkVimBool cfg.changeToVCRoot; + "startify_change_cmd" = cfg.changeDirCmd; + "startify_skiplist" = cfg.skipList; + "startify_update_oldfiles" = mkVimBool cfg.updateOldFiles; + "startify_session_autoload" = mkVimBool cfg.sessionAutoload; + "startify_commands" = cfg.commands; + "startify_files_number" = cfg.filesNumber; + "startify_custom_indices" = cfg.customIndices; + "startify_disable_at_vimenter" = mkVimBool cfg.disableOnStartup; + "startify_enable_unsafe" = mkVimBool cfg.unsafe; + "startify_padding_left" = cfg.paddingLeft; + "startify_use_env" = mkVimBool cfg.useEnv; + "startify_session_before_save" = cfg.sessionBeforeSave; + "startify_session_persistence" = mkVimBool cfg.sessionPersistence; + "startify_session_delete_buffers" = mkVimBool cfg.sessionDeleteBuffers; + "startify_session_dir" = cfg.sessionDir; + "startify_skiplist_server" = cfg.skipListServer; + "startify_session_remove_lines" = cfg.sessionRemoveLines; + "startify_session_savevars" = cfg.sessionSavevars; + "startify_session_savecmds" = cfg.sessionSavecmds; + "startify_session_sort" = mkVimBool cfg.sessionSort; + }; + }; +} diff --git a/modules/dashboard/startify/default.nix b/modules/dashboard/startify/default.nix new file mode 100644 index 0000000..12440c6 --- /dev/null +++ b/modules/dashboard/startify/default.nix @@ -0,0 +1,6 @@ +_: { + imports = [ + ./startify.nix + ./config.nix + ]; +} diff --git a/modules/dashboard/startify.nix b/modules/dashboard/startify/startify.nix similarity index 75% rename from modules/dashboard/startify.nix rename to modules/dashboard/startify/startify.nix index a5fb405..bbf791e 100644 --- a/modules/dashboard/startify.nix +++ b/modules/dashboard/startify/startify.nix @@ -194,43 +194,4 @@ in { type = types.bool; }; }; - - config = mkIf (cfg.enable) { - vim.startPlugins = with pkgs.neovimPlugins; [vim-startify]; - - vim.globals = { - "startify_custom_header" = - if cfg.customHeader == [] - then null - else cfg.customHeader; - "startify_custom_footer" = - if cfg.customFooter == [] - then null - else cfg.customFooter; - "startify_bookmarks" = cfg.bookmarks; - "startify_lists" = cfg.lists; - "startify_change_to_dir" = mkVimBool cfg.changeToDir; - "startify_change_to_vcs_root" = mkVimBool cfg.changeToVCRoot; - "startify_change_cmd" = cfg.changeDirCmd; - "startify_skiplist" = cfg.skipList; - "startify_update_oldfiles" = mkVimBool cfg.updateOldFiles; - "startify_session_autoload" = mkVimBool cfg.sessionAutoload; - "startify_commands" = cfg.commands; - "startify_files_number" = cfg.filesNumber; - "startify_custom_indices" = cfg.customIndices; - "startify_disable_at_vimenter" = mkVimBool cfg.disableOnStartup; - "startify_enable_unsafe" = mkVimBool cfg.unsafe; - "startify_padding_left" = cfg.paddingLeft; - "startify_use_env" = mkVimBool cfg.useEnv; - "startify_session_before_save" = cfg.sessionBeforeSave; - "startify_session_persistence" = mkVimBool cfg.sessionPersistence; - "startify_session_delete_buffers" = mkVimBool cfg.sessionDeleteBuffers; - "startify_session_dir" = cfg.sessionDir; - "startify_skiplist_server" = cfg.skipListServer; - "startify_session_remove_lines" = cfg.sessionRemoveLines; - "startify_session_savevars" = cfg.sessionSavevars; - "startify_session_savecmds" = cfg.sessionSavecmds; - "startify_session_sort" = mkVimBool cfg.sessionSort; - }; - }; }