diff --git a/module/NixOnDroid.nix b/module/NixOnDroid.nix index ea98dc42..24b6e1b9 100644 --- a/module/NixOnDroid.nix +++ b/module/NixOnDroid.nix @@ -36,7 +36,7 @@ in { enable = true; viAlias = true; vimAlias = true; - # extraConfig = (import ./common/Nvim.nix { inputs = inputs; }).customRc; + extraConfig = (import ./common/nvim/Init.nix { inputs = inputs; }).customRc; }; }; diff --git a/module/common/Nvim.nix b/module/common/Nvim.nix index 58a8aa60..3361b41a 100644 --- a/module/common/Nvim.nix +++ b/module/common/Nvim.nix @@ -1,85 +1,5 @@ -{ inputs, lib, ... }: let - nvimRc = { cfgPath, runtimes, cfgs }: let - runtimeRc = builtins.foldl' (acc: r: - acc + "set runtimepath+=${r}\n" - ) "" runtimes; - cfgRc = builtins.foldl' (acc: c: - acc + "lua dofile(\"${cfgPath}/${c}\")\n" - ) "" cfgs; - in runtimeRc + cfgRc; - - customRc = nvimRc { - cfgPath = ./nvim; - runtimes = [ - "~/.cache/nvim" - "~/.cache/nvim/treesitter" - "${inputs.nvimAlign}" - "${inputs.nvimAutoclose}" - "${inputs.nvimBufferline}" - "${inputs.nvimCloseBuffers}" - "${inputs.nvimDevicons}" - "${inputs.nvimGitsigns}" - "${inputs.nvimGruvboxMaterial}" - "${inputs.nvimIndentoMatic}" - "${inputs.nvimLspconfig}" - "${inputs.nvimLualine}" - "${inputs.nvimOllama}" - "${inputs.nvimPlenary}" - "${inputs.nvimSingleComment}" - "${inputs.nvimTelescope}" - "${inputs.nvimTodo}" - "${inputs.nvimTokyonight}" - "${inputs.nvimTreesitter}" - "${inputs.nvimTree}" - "${inputs.nvimTrouble}" - "${inputs.nvimWhichKey}" - ]; - cfgs = [ - "key/Rekey.lua" - "key/Leader.lua" - "config/Autoread.lua" - "config/Etc.lua" - "config/Search.lua" - "config/Tab.lua" - "plugin/Filetree.lua" - "plugin/Gruvbox.lua" - "plugin/Bufferline.lua" - "plugin/Lualine.lua" - "plugin/Autoclose.lua" - "plugin/Gitsigns.lua" - "plugin/Trouble.lua" - "plugin/Tokyonight.lua" - "plugin/Closebuffers.lua" - "plugin/Telescope.lua" - "plugin/Todo.lua" - "plugin/Indent.lua" - "plugin/Align.lua" - "plugin/Treesitter.lua" - "plugin/Fold.lua" - "plugin/Ollama.lua" - "plugin/lsp/Haskell.lua" - "plugin/lsp/Rust.lua" - "plugin/lsp/Tex.lua" - "key/Autocomplete.lua" - "key/Buffer.lua" - "key/Colorscheme.lua" - "key/Comment.lua" - "key/Common.lua" - "key/Filetree.lua" - "key/Fold.lua" - "key/Gitsigns.lua" - "key/Lsp.lua" - "key/Navigation.lua" - "key/Ollama.lua" - "key/Sort.lua" - "key/Telescope.lua" - "key/Terminal.lua" - "key/Todo.lua" - "key/Trouble.lua" - "key/Update.lua" - "key/Whichkey.lua" - ]; - }; +{ inputs, ... }: let + nvimCfg = import ./nvim/Init.nix { inputs = inputs; }; in { environment = { variables = { @@ -92,7 +12,7 @@ in { viAlias = true; vimAlias = true; configure = { - customRC = customRc; + customRC = nvimCfg.customRc; }; }; } diff --git a/module/common/nvim/Init.nix b/module/common/nvim/Init.nix new file mode 100644 index 00000000..5192137b --- /dev/null +++ b/module/common/nvim/Init.nix @@ -0,0 +1,83 @@ +{ inputs, ... }: let + nvimRc = { cfgPath, runtimes, cfgs }: let + runtimeRc = builtins.foldl' (acc: r: + acc + "set runtimepath+=${r}\n" + ) "" runtimes; + cfgRc = builtins.foldl' (acc: c: + acc + "lua dofile(\"${cfgPath}/${c}\")\n" + ) "" cfgs; + in runtimeRc + cfgRc; +in { + customRc = nvimRc { + cfgPath = ./src; + runtimes = [ + "~/.cache/nvim" + "~/.cache/nvim/treesitter" + "${inputs.nvimAlign}" + "${inputs.nvimAutoclose}" + "${inputs.nvimBufferline}" + "${inputs.nvimCloseBuffers}" + "${inputs.nvimDevicons}" + "${inputs.nvimGitsigns}" + "${inputs.nvimGruvboxMaterial}" + "${inputs.nvimIndentoMatic}" + "${inputs.nvimLspconfig}" + "${inputs.nvimLualine}" + "${inputs.nvimOllama}" + "${inputs.nvimPlenary}" + "${inputs.nvimSingleComment}" + "${inputs.nvimTelescope}" + "${inputs.nvimTodo}" + "${inputs.nvimTokyonight}" + "${inputs.nvimTreesitter}" + "${inputs.nvimTree}" + "${inputs.nvimTrouble}" + "${inputs.nvimWhichKey}" + ]; + cfgs = [ + "key/Rekey.lua" + "key/Leader.lua" + "config/Autoread.lua" + "config/Etc.lua" + "config/Search.lua" + "config/Tab.lua" + "plugin/Filetree.lua" + "plugin/Gruvbox.lua" + "plugin/Bufferline.lua" + "plugin/Lualine.lua" + "plugin/Autoclose.lua" + "plugin/Gitsigns.lua" + "plugin/Trouble.lua" + "plugin/Tokyonight.lua" + "plugin/Closebuffers.lua" + "plugin/Telescope.lua" + "plugin/Todo.lua" + "plugin/Indent.lua" + "plugin/Align.lua" + "plugin/Treesitter.lua" + "plugin/Fold.lua" + "plugin/Ollama.lua" + "plugin/lsp/Haskell.lua" + "plugin/lsp/Rust.lua" + "plugin/lsp/Tex.lua" + "key/Autocomplete.lua" + "key/Buffer.lua" + "key/Colorscheme.lua" + "key/Comment.lua" + "key/Common.lua" + "key/Filetree.lua" + "key/Fold.lua" + "key/Gitsigns.lua" + "key/Lsp.lua" + "key/Navigation.lua" + "key/Ollama.lua" + "key/Sort.lua" + "key/Telescope.lua" + "key/Terminal.lua" + "key/Todo.lua" + "key/Trouble.lua" + "key/Update.lua" + "key/Whichkey.lua" + ]; + }; +} diff --git a/module/common/nvim/config/Autoread.lua b/module/common/nvim/src/config/Autoread.lua similarity index 100% rename from module/common/nvim/config/Autoread.lua rename to module/common/nvim/src/config/Autoread.lua diff --git a/module/common/nvim/config/Etc.lua b/module/common/nvim/src/config/Etc.lua similarity index 100% rename from module/common/nvim/config/Etc.lua rename to module/common/nvim/src/config/Etc.lua diff --git a/module/common/nvim/config/Search.lua b/module/common/nvim/src/config/Search.lua similarity index 100% rename from module/common/nvim/config/Search.lua rename to module/common/nvim/src/config/Search.lua diff --git a/module/common/nvim/config/Tab.lua b/module/common/nvim/src/config/Tab.lua similarity index 100% rename from module/common/nvim/config/Tab.lua rename to module/common/nvim/src/config/Tab.lua diff --git a/module/common/nvim/key/Autocomplete.lua b/module/common/nvim/src/key/Autocomplete.lua similarity index 100% rename from module/common/nvim/key/Autocomplete.lua rename to module/common/nvim/src/key/Autocomplete.lua diff --git a/module/common/nvim/key/Buffer.lua b/module/common/nvim/src/key/Buffer.lua similarity index 100% rename from module/common/nvim/key/Buffer.lua rename to module/common/nvim/src/key/Buffer.lua diff --git a/module/common/nvim/key/Colorscheme.lua b/module/common/nvim/src/key/Colorscheme.lua similarity index 100% rename from module/common/nvim/key/Colorscheme.lua rename to module/common/nvim/src/key/Colorscheme.lua diff --git a/module/common/nvim/key/Comment.lua b/module/common/nvim/src/key/Comment.lua similarity index 100% rename from module/common/nvim/key/Comment.lua rename to module/common/nvim/src/key/Comment.lua diff --git a/module/common/nvim/key/Common.lua b/module/common/nvim/src/key/Common.lua similarity index 100% rename from module/common/nvim/key/Common.lua rename to module/common/nvim/src/key/Common.lua diff --git a/module/common/nvim/key/Filetree.lua b/module/common/nvim/src/key/Filetree.lua similarity index 100% rename from module/common/nvim/key/Filetree.lua rename to module/common/nvim/src/key/Filetree.lua diff --git a/module/common/nvim/key/Fold.lua b/module/common/nvim/src/key/Fold.lua similarity index 100% rename from module/common/nvim/key/Fold.lua rename to module/common/nvim/src/key/Fold.lua diff --git a/module/common/nvim/key/Gitsigns.lua b/module/common/nvim/src/key/Gitsigns.lua similarity index 100% rename from module/common/nvim/key/Gitsigns.lua rename to module/common/nvim/src/key/Gitsigns.lua diff --git a/module/common/nvim/key/Leader.lua b/module/common/nvim/src/key/Leader.lua similarity index 100% rename from module/common/nvim/key/Leader.lua rename to module/common/nvim/src/key/Leader.lua diff --git a/module/common/nvim/key/Lsp.lua b/module/common/nvim/src/key/Lsp.lua similarity index 100% rename from module/common/nvim/key/Lsp.lua rename to module/common/nvim/src/key/Lsp.lua diff --git a/module/common/nvim/key/Navigation.lua b/module/common/nvim/src/key/Navigation.lua similarity index 100% rename from module/common/nvim/key/Navigation.lua rename to module/common/nvim/src/key/Navigation.lua diff --git a/module/common/nvim/key/Ollama.lua b/module/common/nvim/src/key/Ollama.lua similarity index 100% rename from module/common/nvim/key/Ollama.lua rename to module/common/nvim/src/key/Ollama.lua diff --git a/module/common/nvim/key/Rekey.lua b/module/common/nvim/src/key/Rekey.lua similarity index 100% rename from module/common/nvim/key/Rekey.lua rename to module/common/nvim/src/key/Rekey.lua diff --git a/module/common/nvim/key/Sort.lua b/module/common/nvim/src/key/Sort.lua similarity index 100% rename from module/common/nvim/key/Sort.lua rename to module/common/nvim/src/key/Sort.lua diff --git a/module/common/nvim/key/Telescope.lua b/module/common/nvim/src/key/Telescope.lua similarity index 100% rename from module/common/nvim/key/Telescope.lua rename to module/common/nvim/src/key/Telescope.lua diff --git a/module/common/nvim/key/Terminal.lua b/module/common/nvim/src/key/Terminal.lua similarity index 100% rename from module/common/nvim/key/Terminal.lua rename to module/common/nvim/src/key/Terminal.lua diff --git a/module/common/nvim/key/Todo.lua b/module/common/nvim/src/key/Todo.lua similarity index 100% rename from module/common/nvim/key/Todo.lua rename to module/common/nvim/src/key/Todo.lua diff --git a/module/common/nvim/key/Trouble.lua b/module/common/nvim/src/key/Trouble.lua similarity index 100% rename from module/common/nvim/key/Trouble.lua rename to module/common/nvim/src/key/Trouble.lua diff --git a/module/common/nvim/key/Update.lua b/module/common/nvim/src/key/Update.lua similarity index 100% rename from module/common/nvim/key/Update.lua rename to module/common/nvim/src/key/Update.lua diff --git a/module/common/nvim/key/Whichkey.lua b/module/common/nvim/src/key/Whichkey.lua similarity index 100% rename from module/common/nvim/key/Whichkey.lua rename to module/common/nvim/src/key/Whichkey.lua diff --git a/module/common/nvim/plugin/Align.lua b/module/common/nvim/src/plugin/Align.lua similarity index 100% rename from module/common/nvim/plugin/Align.lua rename to module/common/nvim/src/plugin/Align.lua diff --git a/module/common/nvim/plugin/Autoclose.lua b/module/common/nvim/src/plugin/Autoclose.lua similarity index 100% rename from module/common/nvim/plugin/Autoclose.lua rename to module/common/nvim/src/plugin/Autoclose.lua diff --git a/module/common/nvim/plugin/Bufferline.lua b/module/common/nvim/src/plugin/Bufferline.lua similarity index 100% rename from module/common/nvim/plugin/Bufferline.lua rename to module/common/nvim/src/plugin/Bufferline.lua diff --git a/module/common/nvim/plugin/Closebuffers.lua b/module/common/nvim/src/plugin/Closebuffers.lua similarity index 100% rename from module/common/nvim/plugin/Closebuffers.lua rename to module/common/nvim/src/plugin/Closebuffers.lua diff --git a/module/common/nvim/plugin/Filetree.lua b/module/common/nvim/src/plugin/Filetree.lua similarity index 100% rename from module/common/nvim/plugin/Filetree.lua rename to module/common/nvim/src/plugin/Filetree.lua diff --git a/module/common/nvim/plugin/Fold.lua b/module/common/nvim/src/plugin/Fold.lua similarity index 100% rename from module/common/nvim/plugin/Fold.lua rename to module/common/nvim/src/plugin/Fold.lua diff --git a/module/common/nvim/plugin/Gitsigns.lua b/module/common/nvim/src/plugin/Gitsigns.lua similarity index 100% rename from module/common/nvim/plugin/Gitsigns.lua rename to module/common/nvim/src/plugin/Gitsigns.lua diff --git a/module/common/nvim/plugin/Gruvbox.lua b/module/common/nvim/src/plugin/Gruvbox.lua similarity index 100% rename from module/common/nvim/plugin/Gruvbox.lua rename to module/common/nvim/src/plugin/Gruvbox.lua diff --git a/module/common/nvim/plugin/Indent.lua b/module/common/nvim/src/plugin/Indent.lua similarity index 100% rename from module/common/nvim/plugin/Indent.lua rename to module/common/nvim/src/plugin/Indent.lua diff --git a/module/common/nvim/plugin/Init.lua b/module/common/nvim/src/plugin/Init.lua similarity index 100% rename from module/common/nvim/plugin/Init.lua rename to module/common/nvim/src/plugin/Init.lua diff --git a/module/common/nvim/plugin/Lualine.lua b/module/common/nvim/src/plugin/Lualine.lua similarity index 100% rename from module/common/nvim/plugin/Lualine.lua rename to module/common/nvim/src/plugin/Lualine.lua diff --git a/module/common/nvim/plugin/Ollama.lua b/module/common/nvim/src/plugin/Ollama.lua similarity index 100% rename from module/common/nvim/plugin/Ollama.lua rename to module/common/nvim/src/plugin/Ollama.lua diff --git a/module/common/nvim/plugin/Telescope.lua b/module/common/nvim/src/plugin/Telescope.lua similarity index 100% rename from module/common/nvim/plugin/Telescope.lua rename to module/common/nvim/src/plugin/Telescope.lua diff --git a/module/common/nvim/plugin/Todo.lua b/module/common/nvim/src/plugin/Todo.lua similarity index 100% rename from module/common/nvim/plugin/Todo.lua rename to module/common/nvim/src/plugin/Todo.lua diff --git a/module/common/nvim/plugin/Tokyonight.lua b/module/common/nvim/src/plugin/Tokyonight.lua similarity index 100% rename from module/common/nvim/plugin/Tokyonight.lua rename to module/common/nvim/src/plugin/Tokyonight.lua diff --git a/module/common/nvim/plugin/Treesitter.lua b/module/common/nvim/src/plugin/Treesitter.lua similarity index 100% rename from module/common/nvim/plugin/Treesitter.lua rename to module/common/nvim/src/plugin/Treesitter.lua diff --git a/module/common/nvim/plugin/Trouble.lua b/module/common/nvim/src/plugin/Trouble.lua similarity index 100% rename from module/common/nvim/plugin/Trouble.lua rename to module/common/nvim/src/plugin/Trouble.lua diff --git a/module/common/nvim/plugin/lsp/Haskell.lua b/module/common/nvim/src/plugin/lsp/Haskell.lua similarity index 100% rename from module/common/nvim/plugin/lsp/Haskell.lua rename to module/common/nvim/src/plugin/lsp/Haskell.lua diff --git a/module/common/nvim/plugin/lsp/Kotlin.lua b/module/common/nvim/src/plugin/lsp/Kotlin.lua similarity index 100% rename from module/common/nvim/plugin/lsp/Kotlin.lua rename to module/common/nvim/src/plugin/lsp/Kotlin.lua diff --git a/module/common/nvim/plugin/lsp/Python.lua b/module/common/nvim/src/plugin/lsp/Python.lua similarity index 100% rename from module/common/nvim/plugin/lsp/Python.lua rename to module/common/nvim/src/plugin/lsp/Python.lua diff --git a/module/common/nvim/plugin/lsp/Rust.lua b/module/common/nvim/src/plugin/lsp/Rust.lua similarity index 100% rename from module/common/nvim/plugin/lsp/Rust.lua rename to module/common/nvim/src/plugin/lsp/Rust.lua diff --git a/module/common/nvim/plugin/lsp/Tex.lua b/module/common/nvim/src/plugin/lsp/Tex.lua similarity index 100% rename from module/common/nvim/plugin/lsp/Tex.lua rename to module/common/nvim/src/plugin/lsp/Tex.lua