mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-31 02:52:37 +00:00 
			
		
		
		
	modules/notes: switch to explicit lib calls
This commit is contained in:
		
					parent
					
						
							
								f6db808bfc
							
						
					
				
			
			
				commit
				
					
						2101ac9061
					
				
			
		
					 13 changed files with 154 additions and 144 deletions
				
			
		|  | @ -1,4 +1,4 @@ | ||||||
| _: { | { | ||||||
|   imports = [ |   imports = [ | ||||||
|     ./obsidian |     ./obsidian | ||||||
|     ./orgmode |     ./orgmode | ||||||
|  |  | ||||||
|  | @ -3,27 +3,31 @@ | ||||||
|   lib, |   lib, | ||||||
|   ... |   ... | ||||||
| }: let | }: let | ||||||
|   inherit (lib) mkIf nvim pushDownDefault; |   inherit (lib.modules) mkIf; | ||||||
|  |   inherit (lib.nvim.dag) entryAnywhere; | ||||||
|  |   inherit (lib.nvim.binds) pushDownDefault; | ||||||
| 
 | 
 | ||||||
|   cfg = config.vim.notes.mind-nvim; |   cfg = config.vim.notes.mind-nvim; | ||||||
| in { | in { | ||||||
|   config = mkIf (cfg.enable) { |   config = mkIf cfg.enable { | ||||||
|     vim.startPlugins = [ |     vim = { | ||||||
|  |       startPlugins = [ | ||||||
|         "mind-nvim" |         "mind-nvim" | ||||||
|       ]; |       ]; | ||||||
| 
 | 
 | ||||||
|     vim.maps.normal = { |       maps.normal = { | ||||||
|         "<leader>om" = {action = ":MindOpenMain<CR>";}; |         "<leader>om" = {action = ":MindOpenMain<CR>";}; | ||||||
|         "<leader>op" = {action = ":MindOpenProject<CR>";}; |         "<leader>op" = {action = ":MindOpenProject<CR>";}; | ||||||
|         "<leader>oc" = {action = ":MindClose<CR>";}; |         "<leader>oc" = {action = ":MindClose<CR>";}; | ||||||
|       }; |       }; | ||||||
| 
 | 
 | ||||||
|     vim.binds.whichKey.register = pushDownDefault { |       binds.whichKey.register = pushDownDefault { | ||||||
|         "<leader>o" = "+Notes"; |         "<leader>o" = "+Notes"; | ||||||
|       }; |       }; | ||||||
| 
 | 
 | ||||||
|     vim.luaConfigRC.mind-nvim = nvim.dag.entryAnywhere '' |       luaConfigRC.mind-nvim = entryAnywhere '' | ||||||
|         require'mind'.setup() |         require'mind'.setup() | ||||||
|       ''; |       ''; | ||||||
|     }; |     }; | ||||||
|  |   }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| _: { | { | ||||||
|   imports = [ |   imports = [ | ||||||
|     ./mind-nvim.nix |     ./mind-nvim.nix | ||||||
|     ./config.nix |     ./config.nix | ||||||
|  |  | ||||||
|  | @ -1,11 +1,7 @@ | ||||||
| { | {lib, ...}: let | ||||||
|   config, |   inherit (lib.options) mkEnableOption; | ||||||
|   lib, |  | ||||||
|   ... |  | ||||||
| }: let |  | ||||||
|   inherit (lib) mkEnableOption; |  | ||||||
| in { | in { | ||||||
|   options.vim.notes.mind-nvim = { |   options.vim.notes.mind-nvim = { | ||||||
|     enable = mkEnableOption "organizer tool for Neovim."; |     enable = mkEnableOption "note organizer tool for Neovim [mind-nvim]"; | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -3,23 +3,26 @@ | ||||||
|   lib, |   lib, | ||||||
|   ... |   ... | ||||||
| }: let | }: let | ||||||
|   inherit (lib) mkIf nvim pushDownDefault; |   inherit (lib.modules) mkIf; | ||||||
|  |   inherit (lib.nvim.dag) entryAnywhere; | ||||||
|  |   inherit (lib.nvim.binds) pushDownDefault; | ||||||
| 
 | 
 | ||||||
|   cfg = config.vim.notes.obsidian; |   cfg = config.vim.notes.obsidian; | ||||||
|   auto = config.vim.autocomplete; |   auto = config.vim.autocomplete; | ||||||
| in { | in { | ||||||
|   config = mkIf (cfg.enable) { |   config = mkIf cfg.enable { | ||||||
|     vim.startPlugins = [ |     vim = { | ||||||
|  |       startPlugins = [ | ||||||
|         "obsidian-nvim" |         "obsidian-nvim" | ||||||
|         "vim-markdown" |         "vim-markdown" | ||||||
|         "tabular" |         "tabular" | ||||||
|       ]; |       ]; | ||||||
| 
 | 
 | ||||||
|     vim.binds.whichKey.register = pushDownDefault { |       binds.whichKey.register = pushDownDefault { | ||||||
|         "<leader>o" = "+Notes"; |         "<leader>o" = "+Notes"; | ||||||
|       }; |       }; | ||||||
| 
 | 
 | ||||||
|     vim.luaConfigRC.obsidian = nvim.dag.entryAnywhere '' |       luaConfigRC.obsidian = entryAnywhere '' | ||||||
|         require("obsidian").setup({ |         require("obsidian").setup({ | ||||||
|           dir = "${cfg.dir}", |           dir = "${cfg.dir}", | ||||||
|           completion = { |           completion = { | ||||||
|  | @ -44,4 +47,5 @@ in { | ||||||
|         }) |         }) | ||||||
|       ''; |       ''; | ||||||
|     }; |     }; | ||||||
|  |   }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| _: { | { | ||||||
|   imports = [ |   imports = [ | ||||||
|     ./obsidian.nix |     ./obsidian.nix | ||||||
|     ./config.nix |     ./config.nix | ||||||
|  |  | ||||||
|  | @ -1,27 +1,24 @@ | ||||||
| { | {lib, ...}: let | ||||||
|   config, |   inherit (lib.options) mkEnableOption mkOption; | ||||||
|   lib, |   inherit (lib.types) str bool; | ||||||
|   ... |  | ||||||
| }: let |  | ||||||
|   inherit (lib) mkEnableOption mkOption types; |  | ||||||
| in { | in { | ||||||
|   options.vim.notes = { |   options.vim.notes = { | ||||||
|     obsidian = { |     obsidian = { | ||||||
|       enable = mkEnableOption "complementary neovim plugins for Obsidian editor"; |       enable = mkEnableOption "complementary neovim plugins for Obsidian editor"; | ||||||
|       dir = mkOption { |       dir = mkOption { | ||||||
|         type = types.str; |         type = str; | ||||||
|         default = "~/my-vault"; |         default = "~/my-vault"; | ||||||
|         description = "Obsidian vault directory"; |         description = "Obsidian vault directory"; | ||||||
|       }; |       }; | ||||||
| 
 | 
 | ||||||
|       daily-notes = { |       daily-notes = { | ||||||
|         folder = mkOption { |         folder = mkOption { | ||||||
|           type = types.str; |           type = str; | ||||||
|           default = ""; |           default = ""; | ||||||
|           description = "Directory in which daily notes should be created"; |           description = "Directory in which daily notes should be created"; | ||||||
|         }; |         }; | ||||||
|         date-format = mkOption { |         date-format = mkOption { | ||||||
|           type = types.str; |           type = str; | ||||||
|           default = ""; |           default = ""; | ||||||
|           description = "Date format used for creating daily notes"; |           description = "Date format used for creating daily notes"; | ||||||
|         }; |         }; | ||||||
|  | @ -29,8 +26,7 @@ in { | ||||||
| 
 | 
 | ||||||
|       completion = { |       completion = { | ||||||
|         nvim_cmp = mkOption { |         nvim_cmp = mkOption { | ||||||
|           # if using nvim-cmp, otherwise set to false |           type = bool; | ||||||
|           type = types.bool; |  | ||||||
|           description = "If using nvim-cmp, otherwise set to false"; |           description = "If using nvim-cmp, otherwise set to false"; | ||||||
|         }; |         }; | ||||||
|       }; |       }; | ||||||
|  |  | ||||||
|  | @ -3,21 +3,24 @@ | ||||||
|   lib, |   lib, | ||||||
|   ... |   ... | ||||||
| }: let | }: let | ||||||
|   inherit (lib) mkIf mkMerge nvim pushDownDefault; |   inherit (lib.modules) mkIf mkMerge; | ||||||
|  |   inherit (lib.nvim.dag) entryAnywhere; | ||||||
|  |   inherit (lib.nvim.binds) pushDownDefault; | ||||||
| 
 | 
 | ||||||
|   cfg = config.vim.notes.orgmode; |   cfg = config.vim.notes.orgmode; | ||||||
| in { | in { | ||||||
|   config = mkIf cfg.enable (mkMerge [ |   config = mkIf cfg.enable (mkMerge [ | ||||||
|     { |     { | ||||||
|       vim.startPlugins = [ |       vim = { | ||||||
|  |         startPlugins = [ | ||||||
|           "orgmode-nvim" |           "orgmode-nvim" | ||||||
|         ]; |         ]; | ||||||
| 
 | 
 | ||||||
|       vim.binds.whichKey.register = pushDownDefault { |         binds.whichKey.register = pushDownDefault { | ||||||
|           "<leader>o" = "+Notes"; |           "<leader>o" = "+Notes"; | ||||||
|         }; |         }; | ||||||
| 
 | 
 | ||||||
|       vim.luaConfigRC.orgmode = nvim.dag.entryAnywhere '' |         luaConfigRC.orgmode = entryAnywhere '' | ||||||
|           -- Load custom treesitter grammar for org filetype |           -- Load custom treesitter grammar for org filetype | ||||||
|           require('orgmode').setup_ts_grammar() |           require('orgmode').setup_ts_grammar() | ||||||
| 
 | 
 | ||||||
|  | @ -39,6 +42,7 @@ in { | ||||||
|             org_default_notes_file = '${cfg.orgDefaultNotesFile}', |             org_default_notes_file = '${cfg.orgDefaultNotesFile}', | ||||||
|           }) |           }) | ||||||
|         ''; |         ''; | ||||||
|  |       }; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     (mkIf cfg.treesitter.enable { |     (mkIf cfg.treesitter.enable { | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| _: { | { | ||||||
|   imports = [ |   imports = [ | ||||||
|     ./orgmode.nix |     ./orgmode.nix | ||||||
|     ./config.nix |     ./config.nix | ||||||
|  |  | ||||||
|  | @ -4,27 +4,28 @@ | ||||||
|   pkgs, |   pkgs, | ||||||
|   ... |   ... | ||||||
| }: let | }: let | ||||||
|   inherit (lib) mkEnableOption types mkOption nvim; |   inherit (lib.options) mkOption mkEnableOption; | ||||||
|  |   inherit (lib.types) str; | ||||||
|  |   inherit (lib.nvim.types) mkGrammarOption; | ||||||
| in { | in { | ||||||
|   options.vim.notes.orgmode = { |   options.vim.notes.orgmode = { | ||||||
|     enable = mkEnableOption "nvim-orgmode: Neovim plugin for Emac Orgmode. Get the best of both worlds"; |     enable = mkEnableOption "nvim-orgmode: Neovim plugin for Emac Orgmode. Get the best of both worlds"; | ||||||
| 
 | 
 | ||||||
|     orgAgendaFiles = mkOption { |     orgAgendaFiles = mkOption { | ||||||
|       type = types.str; |       type = str; | ||||||
|       default = "{'~/Documents/org/*', '~/my-orgs/**/*'}"; |       default = "{'~/Documents/org/*', '~/my-orgs/**/*'}"; | ||||||
|       description = "List of org files to be used as agenda files."; |       description = "List of org files to be used as agenda files."; | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     orgDefaultNotesFile = mkOption { |     orgDefaultNotesFile = mkOption { | ||||||
|       type = types.str; |       type = str; | ||||||
|       default = "~/Documents/org/refile.org"; |       default = "~/Documents/org/refile.org"; | ||||||
|       description = "Default org file to be used for notes."; |       description = "Default org file to be used for notes."; | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     treesitter = { |     treesitter = { | ||||||
|       enable = mkEnableOption "Orgmode treesitter" // {default = config.vim.languages.enableTreesitter;}; |       enable = mkEnableOption "Orgmode treesitter" // {default = config.vim.languages.enableTreesitter;}; | ||||||
| 
 |       orgPackage = mkGrammarOption pkgs "org"; | ||||||
|       orgPackage = nvim.types.mkGrammarOption pkgs "org"; |  | ||||||
|     }; |     }; | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -4,24 +4,26 @@ | ||||||
|   lib, |   lib, | ||||||
|   ... |   ... | ||||||
| }: let | }: let | ||||||
|   inherit (lib) mkMerge mkBinding mkIf; |   inherit (lib.modules) mkIf mkMerge; | ||||||
|  |   inherit (lib.nvim.binds) mkBinding; | ||||||
| 
 | 
 | ||||||
|   cfg = config.vim.notes.todo-comments; |   cfg = config.vim.notes.todo-comments; | ||||||
|   self = import ./todo-comments.nix {inherit lib;}; |   self = import ./todo-comments.nix {inherit lib;}; | ||||||
|   mappings = self.options.vim.notes.todo-comments.mappings; |   inherit (self.options.vim.notes.todo-comments) mappings; | ||||||
| in { | in { | ||||||
|   config = mkIf (cfg.enable) { |   config = mkIf cfg.enable { | ||||||
|     vim.startPlugins = [ |     vim = { | ||||||
|  |       startPlugins = [ | ||||||
|         "todo-comments" |         "todo-comments" | ||||||
|       ]; |       ]; | ||||||
| 
 | 
 | ||||||
|     vim.maps.normal = mkMerge [ |       maps.normal = mkMerge [ | ||||||
|         (mkBinding cfg.mappings.quickFix ":TodoQuickFix<CR>" mappings.quickFix.description) |         (mkBinding cfg.mappings.quickFix ":TodoQuickFix<CR>" mappings.quickFix.description) | ||||||
|         (mkIf config.vim.telescope.enable (mkBinding cfg.mappings.telescope ":TodoTelescope<CR>" mappings.telescope.description)) |         (mkIf config.vim.telescope.enable (mkBinding cfg.mappings.telescope ":TodoTelescope<CR>" mappings.telescope.description)) | ||||||
|         (mkIf config.vim.lsp.trouble.enable (mkBinding cfg.mappings.trouble ":TodoTrouble<CR>" mappings.trouble.description)) |         (mkIf config.vim.lsp.trouble.enable (mkBinding cfg.mappings.trouble ":TodoTrouble<CR>" mappings.trouble.description)) | ||||||
|       ]; |       ]; | ||||||
| 
 | 
 | ||||||
|     vim.luaConfigRC.todo-comments = '' |       luaConfigRC.todo-comments = '' | ||||||
|         require('todo-comments').setup { |         require('todo-comments').setup { | ||||||
|           highlight = { |           highlight = { | ||||||
|             before = "", -- "fg" or "bg" or empty |             before = "", -- "fg" or "bg" or empty | ||||||
|  | @ -46,4 +48,5 @@ in { | ||||||
|         } |         } | ||||||
|       ''; |       ''; | ||||||
|     }; |     }; | ||||||
|  |   }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| _: { | { | ||||||
|   imports = [ |   imports = [ | ||||||
|     ./todo-comments.nix |     ./todo-comments.nix | ||||||
|     ./config.nix |     ./config.nix | ||||||
|  |  | ||||||
|  | @ -1,18 +1,20 @@ | ||||||
| {lib, ...}: let | {lib, ...}: let | ||||||
|   inherit (lib) mkEnableOption mkOption types mkMappingOption; |   inherit (lib.options) mkOption mkEnableOption; | ||||||
|  |   inherit (lib.types) str; | ||||||
|  |   inherit (lib.nvim.binds) mkMappingOption; | ||||||
| in { | in { | ||||||
|   options.vim.notes.todo-comments = { |   options.vim.notes.todo-comments = { | ||||||
|     enable = mkEnableOption "todo-comments: highlight and search for todo comments like TODO, HACK, BUG in your code base"; |     enable = mkEnableOption "todo-comments: highlight and search for todo comments like TODO, HACK, BUG in your code base"; | ||||||
| 
 | 
 | ||||||
|     patterns = { |     patterns = { | ||||||
|       highlight = mkOption { |       highlight = mkOption { | ||||||
|         type = types.str; |         type = str; | ||||||
|         default = ''[[.*<(KEYWORDS)(\([^\)]*\))?:]]''; |         default = ''[[.*<(KEYWORDS)(\([^\)]*\))?:]]''; | ||||||
|         description = "vim regex pattern used for highlighting comments"; |         description = "vim regex pattern used for highlighting comments"; | ||||||
|       }; |       }; | ||||||
| 
 | 
 | ||||||
|       search = mkOption { |       search = mkOption { | ||||||
|         type = types.str; |         type = str; | ||||||
|         default = ''[[\b(KEYWORDS)(\([^\)]*\))?:]]''; |         default = ''[[\b(KEYWORDS)(\([^\)]*\))?:]]''; | ||||||
|         description = "ripgrep regex pattern used for searching comments"; |         description = "ripgrep regex pattern used for searching comments"; | ||||||
|       }; |       }; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue