| 
									
										
										
										
											2022-11-09 22:15:47 +01:00
										 |  |  | # Dashboard site | 
					
						
							| 
									
										
										
										
											2022-01-23 23:35:00 +01:00
										 |  |  | { config, lib, pkgs, ... }: | 
					
						
							| 
									
										
										
										
											2022-11-09 22:15:47 +01:00
										 |  |  | let | 
					
						
							|  |  |  |   cfg = config.my.services.homer; | 
					
						
							|  |  |  |   domain = config.networking.domain; | 
					
						
							| 
									
										
										
										
											2022-01-23 23:35:00 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-09 22:15:47 +01:00
										 |  |  |   homeConfig = { | 
					
						
							|  |  |  |     title = "Dashboard"; | 
					
						
							|  |  |  |     header = false; | 
					
						
							|  |  |  |     footer = false; | 
					
						
							|  |  |  |     connectivityCheck = true; | 
					
						
							|  |  |  |     colums = "auto"; | 
					
						
							|  |  |  |     services = config.lib.webapps.homerServices; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | in | 
					
						
							| 
									
										
										
										
											2022-01-23 23:35:00 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2022-11-09 22:15:47 +01:00
										 |  |  |   imports = [ | 
					
						
							|  |  |  |     ./config.nix | 
					
						
							|  |  |  |   ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   options.my.services.homer = with lib; { | 
					
						
							|  |  |  |     enable = mkEnableOption "Homer Dashboard"; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   config = lib.mkIf cfg.enable { | 
					
						
							|  |  |  |     services.nginx.virtualHosts = { | 
					
						
							|  |  |  |       # This is not a subdomain, cannot use my nginx wrapper module | 
					
						
							|  |  |  |       ${domain} = { | 
					
						
							|  |  |  |         forceSSL = true; | 
					
						
							|  |  |  |         useACMEHost = domain; | 
					
						
							|  |  |  |         root = pkgs.homer; | 
					
						
							|  |  |  |         locations."=/assets/config.yml" = { | 
					
						
							|  |  |  |           alias = pkgs.writeText "homerConfig.yml" (builtins.toJSON homeConfig); | 
					
						
							| 
									
										
										
										
											2022-01-23 23:35:00 +01:00
										 |  |  |         }; | 
					
						
							| 
									
										
										
										
											2022-11-09 22:15:47 +01:00
										 |  |  |       }; | 
					
						
							|  |  |  |       # redirect any other attempt to the main site | 
					
						
							|  |  |  |       "${domain}-redirect" = { | 
					
						
							|  |  |  |         forceSSL = true; | 
					
						
							|  |  |  |         useACMEHost = domain; | 
					
						
							|  |  |  |         default = true; | 
					
						
							|  |  |  |         globalRedirect = "${domain}"; | 
					
						
							|  |  |  |       }; | 
					
						
							| 
									
										
										
										
											2022-01-23 23:35:00 +01:00
										 |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-09 22:15:47 +01:00
										 |  |  |     webapps = { | 
					
						
							|  |  |  |       dashboardCategories = [ | 
					
						
							|  |  |  |         { name = "Applications"; tag = "app"; } | 
					
						
							|  |  |  |         { name = "Media"; tag = "media"; } | 
					
						
							|  |  |  |         { name = "Infrastructure"; tag = "infra"; } | 
					
						
							| 
									
										
										
										
											2022-12-25 12:20:20 +01:00
										 |  |  |         { name = "Others"; tag = "other"; } | 
					
						
							| 
									
										
										
										
											2022-11-09 22:15:47 +01:00
										 |  |  |       ]; | 
					
						
							| 
									
										
										
										
											2022-01-23 23:35:00 +01:00
										 |  |  |     }; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | } |