forked from fabian/nix
		
	doctrine/lib: support module dependencies
This commit is contained in:
		
							parent
							
								
									3152a0f626
								
							
						
					
					
						commit
						3121013376
					
				
					 1 changed files with 17 additions and 5 deletions
				
			
		|  | @ -1,12 +1,14 @@ | ||||||
| { | { | ||||||
|  |   # The first few arguments are implicitly passed by the 'close' helper | ||||||
|  |   lib, | ||||||
|  |   pkgs, | ||||||
|  |   doctrine, | ||||||
|   name, |   name, | ||||||
|  |   config, | ||||||
|   hm ? null, |   hm ? null, | ||||||
|   sys ? null, |   sys ? null, | ||||||
|   options ? null, |   options ? null, | ||||||
|   lib, |   requires ? [], | ||||||
|   config, |  | ||||||
|   pkgs, |  | ||||||
|   doctrine, |  | ||||||
| }: let | }: let | ||||||
|   optionsSet = import options { |   optionsSet = import options { | ||||||
|     inherit config lib pkgs cfg name doctrine; |     inherit config lib pkgs cfg name doctrine; | ||||||
|  | @ -24,7 +26,17 @@ | ||||||
| in { | in { | ||||||
|   config = |   config = | ||||||
|     lib.optionalAttrs (configFiles ? ${doctrine.namespace}) |     lib.optionalAttrs (configFiles ? ${doctrine.namespace}) | ||||||
|     (lib.mkIf cfg.enable configSet); |     (lib.mkIf cfg.enable (lib.mkMerge [ | ||||||
|  |       configSet | ||||||
|  |       { | ||||||
|  |         assertions = | ||||||
|  |           map (dependency: { | ||||||
|  |             assertion = cfg.enable -> config.${doctrine.prefix}.${dependency}.enable; | ||||||
|  |             message = "${doctrine.prefix}.${name}.enable requires ${doctrine.prefix}.${dependency}.enable"; | ||||||
|  |           }) | ||||||
|  |           requires; | ||||||
|  |       } | ||||||
|  |     ])); | ||||||
| 
 | 
 | ||||||
|   options.${doctrine.prefix}.${name} = |   options.${doctrine.prefix}.${name} = | ||||||
|     lib.optionalAttrs (options != null && optionsSet ? ${doctrine.namespace}) optionsSet.${doctrine.namespace} |     lib.optionalAttrs (options != null && optionsSet ? ${doctrine.namespace}) optionsSet.${doctrine.namespace} | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Alejandro Soto
						Alejandro Soto