| 
									
										
										
										
											2016-10-31 11:25:50 +01:00
										 |  |  | { config, lib, pkgs, ... }: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | with lib; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   meta.maintainers = [ maintainers.mic92 ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   ###### interface | 
					
						
							|  |  |  |   options = { | 
					
						
							|  |  |  |     programs.adb = { | 
					
						
							|  |  |  |       enable = mkOption { | 
					
						
							|  |  |  |         default = false; | 
					
						
							|  |  |  |         type = types.bool; | 
					
						
							|  |  |  |         description = ''
 | 
					
						
							|  |  |  |           Whether to configure system to use Android Debug Bridge (adb). | 
					
						
							|  |  |  |           To grant access to a user, it must be part of adbusers group: | 
					
						
							| 
									
										
										
										
											2018-06-30 01:58:35 +02:00
										 |  |  |           <code>users.users.alice.extraGroups = ["adbusers"];</code> | 
					
						
							| 
									
										
										
										
											2016-10-31 11:25:50 +01:00
										 |  |  |         '';
 | 
					
						
							|  |  |  |       }; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   ###### implementation | 
					
						
							|  |  |  |   config = mkIf config.programs.adb.enable { | 
					
						
							|  |  |  |     services.udev.packages = [ pkgs.android-udev-rules ]; | 
					
						
							| 
									
										
										
										
											2019-11-16 14:33:37 -06:00
										 |  |  |     # Give platform-tools lower priority so mke2fs+friends are taken from other packages first | 
					
						
							|  |  |  |     environment.systemPackages = [ (lowPrio pkgs.androidenv.androidPkgs_9_0.platform-tools) ]; | 
					
						
							| 
									
										
										
										
											2018-06-30 01:58:35 +02:00
										 |  |  |     users.groups.adbusers = {}; | 
					
						
							| 
									
										
										
										
											2016-10-31 11:25:50 +01:00
										 |  |  |   }; | 
					
						
							|  |  |  | } |