mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-31 02:52:37 +00:00 
			
		
		
		
	nixos: use proper submodule type for settings
This commit is contained in:
		
					parent
					
						
							
								8c1352502a
							
						
					
				
			
			
				commit
				
					
						98b36e08f0
					
				
			
		
					 2 changed files with 14 additions and 10 deletions
				
			
		|  | @ -42,7 +42,7 @@ | ||||||
|         }; |         }; | ||||||
| 
 | 
 | ||||||
|         nixosModules = { |         nixosModules = { | ||||||
|           nvf = import ./flake/modules/nixos.nix self.packages lib; |           nvf = import ./flake/modules/nixos.nix self.packages lib inputs; | ||||||
|           default = self.nixosModules.nvf; |           default = self.nixosModules.nvf; | ||||||
|           neovim-flake = |           neovim-flake = | ||||||
|             lib.warn '' |             lib.warn '' | ||||||
|  |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| # NixOS module | # NixOS module | ||||||
| packages: lib: { | packages: lib: inputs: { | ||||||
|   config, |   config, | ||||||
|   pkgs, |   pkgs, | ||||||
|   ... |   ... | ||||||
|  | @ -8,15 +8,19 @@ packages: lib: { | ||||||
|   inherit (lib.modules) mkIf mkOverride mkAliasOptionModule; |   inherit (lib.modules) mkIf mkOverride mkAliasOptionModule; | ||||||
|   inherit (lib.lists) optional; |   inherit (lib.lists) optional; | ||||||
|   inherit (lib.options) mkOption mkEnableOption literalExpression; |   inherit (lib.options) mkOption mkEnableOption literalExpression; | ||||||
|   inherit (lib.types) attrsOf anything bool; |   inherit (lib.types) anything bool submoduleWith; | ||||||
|   inherit (lib.nvim) neovimConfiguration; |  | ||||||
|   inherit (lib.nvim.types) anythingConcatLists; |  | ||||||
| 
 | 
 | ||||||
|   cfg = config.programs.nvf; |   cfg = config.programs.nvf; | ||||||
| 
 | 
 | ||||||
|   neovimConfigured = neovimConfiguration { |   nvfModule = submoduleWith { | ||||||
|     inherit pkgs; |     description = "Nvf module"; | ||||||
|     modules = [cfg.settings]; |     class = "nvf"; | ||||||
|  |     specialArgs = { | ||||||
|  |       inherit pkgs lib inputs; | ||||||
|  |     }; | ||||||
|  |     modules = [ | ||||||
|  |       {imports = import ../../modules/modules.nix {inherit pkgs lib;};} | ||||||
|  |     ]; | ||||||
|   }; |   }; | ||||||
| in { | in { | ||||||
|   imports = [ |   imports = [ | ||||||
|  | @ -55,7 +59,7 @@ in { | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     settings = mkOption { |     settings = mkOption { | ||||||
|       type = attrsOf anythingConcatLists; |       type = nvfModule; | ||||||
|       default = {}; |       default = {}; | ||||||
|       description = "Attribute set of nvf preferences."; |       description = "Attribute set of nvf preferences."; | ||||||
|       example = literalExpression '' |       example = literalExpression '' | ||||||
|  | @ -78,7 +82,7 @@ in { | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   config = mkIf cfg.enable { |   config = mkIf cfg.enable { | ||||||
|     programs.nvf.finalPackage = neovimConfigured.neovim; |     programs.nvf.finalPackage = cfg.settings.vim.build.finalPackage; | ||||||
| 
 | 
 | ||||||
|     environment = { |     environment = { | ||||||
|       variables.EDITOR = mkIf cfg.defaultEditor (mkOverride 900 "nvim"); |       variables.EDITOR = mkIf cfg.defaultEditor (mkOverride 900 "nvim"); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Ching Pei Yang
				Ching Pei Yang