| 
									
										
										
										
											2023-06-04 14:29:21 +02:00
										 |  |  | # to download things | 
					
						
							| 
									
										
										
										
											2024-07-28 21:08:02 +02:00
										 |  |  | { | 
					
						
							|  |  |  |   config, | 
					
						
							|  |  |  |   lib, | 
					
						
							|  |  |  |   pkgs, | 
					
						
							|  |  |  |   ... | 
					
						
							|  |  |  | }: | 
					
						
							| 
									
										
										
										
											2023-06-04 14:29:21 +02:00
										 |  |  | let | 
					
						
							|  |  |  |   cfg = config.my.services.aria2; | 
					
						
							| 
									
										
										
										
											2023-11-07 23:13:51 +01:00
										 |  |  |   inherit (config.networking) domain; | 
					
						
							| 
									
										
										
										
											2023-06-04 14:29:21 +02:00
										 |  |  | in | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   options.my.services.aria2 = with lib; { | 
					
						
							|  |  |  |     enable = mkEnableOption "Aria2 for downloads"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     downloadDir = mkOption { | 
					
						
							|  |  |  |       type = types.path; | 
					
						
							|  |  |  |       description = mdDoc ''
 | 
					
						
							|  |  |  |         Directory to store downloaded files. | 
					
						
							|  |  |  |       '';
 | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   config = lib.mkIf cfg.enable { | 
					
						
							|  |  |  |     services.aria2 = { | 
					
						
							| 
									
										
										
										
											2023-06-04 14:30:45 +02:00
										 |  |  |       enable = true; | 
					
						
							|  |  |  |       openPorts = true; | 
					
						
							| 
									
										
										
										
											2023-06-04 14:29:21 +02:00
										 |  |  |       inherit (cfg) downloadDir; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     my.services.nginx.virtualHosts = [ | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         subdomain = "download"; | 
					
						
							|  |  |  |         root = "${pkgs.ariang}/share/ariang"; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     webapps.apps.aria2 = { | 
					
						
							|  |  |  |       dashboard = { | 
					
						
							|  |  |  |         name = "Download"; | 
					
						
							|  |  |  |         category = "app"; | 
					
						
							|  |  |  |         icon = "download"; | 
					
						
							| 
									
										
										
										
											2023-11-12 20:39:44 +01:00
										 |  |  |         url = "https://download.${domain}"; | 
					
						
							| 
									
										
										
										
											2023-06-04 14:29:21 +02:00
										 |  |  |       }; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | } |