| 
									
										
										
										
											2022-11-09 22:17:13 +01:00
										 |  |  | # document management system | 
					
						
							| 
									
										
										
										
											2023-11-07 22:00:00 +01:00
										 |  |  | { config, lib, ... }: | 
					
						
							| 
									
										
										
										
											2022-11-09 22:17:13 +01:00
										 |  |  | let | 
					
						
							|  |  |  |   cfg = config.my.services.paperless; | 
					
						
							| 
									
										
										
										
											2023-11-07 23:13:51 +01:00
										 |  |  |   inherit (config.networking) domain; | 
					
						
							| 
									
										
										
										
											2022-11-09 22:17:13 +01:00
										 |  |  | in | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   options.my.services.paperless = with lib; { | 
					
						
							|  |  |  |     enable = mkEnableOption "Paperless Server"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     passwordFile = mkOption { | 
					
						
							|  |  |  |       type = types.path; | 
					
						
							|  |  |  |       description = "Password for the defaultUser for FreshRSS."; | 
					
						
							|  |  |  |       example = "/run/secrets/freshrss"; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     port = mkOption { | 
					
						
							|  |  |  |       type = types.port; | 
					
						
							|  |  |  |       default = 28981; | 
					
						
							|  |  |  |       example = 8080; | 
					
						
							|  |  |  |       description = "Internal port for webui"; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-05 22:19:45 +02:00
										 |  |  |     mediaDir = mkOption { | 
					
						
							|  |  |  |       type = types.path; | 
					
						
							| 
									
										
										
										
											2024-03-10 22:13:00 +01:00
										 |  |  |       description = "Location of the FreshRSS data."; | 
					
						
							| 
									
										
										
										
											2023-09-05 22:19:45 +02:00
										 |  |  |       example = "/run/secrets/freshrss"; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-01 18:44:04 +02:00
										 |  |  |     settings = mkOption { | 
					
						
							| 
									
										
										
										
											2022-11-09 22:17:13 +01:00
										 |  |  |       type = types.attrs; | 
					
						
							|  |  |  |       default = { }; | 
					
						
							|  |  |  |       description = "additional extraConfig"; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   config = lib.mkIf cfg.enable { | 
					
						
							|  |  |  |     services.paperless = { | 
					
						
							|  |  |  |       enable = true; | 
					
						
							| 
									
										
										
										
											2024-03-10 22:13:00 +01:00
										 |  |  |       inherit (cfg) port mediaDir passwordFile; | 
					
						
							| 
									
										
										
										
											2024-06-01 18:44:04 +02:00
										 |  |  |       settings = { | 
					
						
							| 
									
										
										
										
											2022-11-09 22:17:13 +01:00
										 |  |  |         PAPERLESS_OCR_LANGUAGE = "deu+eng"; | 
					
						
							| 
									
										
										
										
											2024-06-01 18:44:04 +02:00
										 |  |  |       } // cfg.settings; | 
					
						
							| 
									
										
										
										
											2022-11-09 22:17:13 +01:00
										 |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-29 23:39:37 +01:00
										 |  |  |     # monitoring is not really useful, because it only contains the http-worker infos -> skipped for now | 
					
						
							| 
									
										
										
										
											2023-06-04 22:34:36 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-09 22:17:13 +01:00
										 |  |  |     my.services.nginx.virtualHosts = [ | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         subdomain = "docs"; | 
					
						
							|  |  |  |         inherit (cfg) port; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     webapps.apps.paperless = { | 
					
						
							|  |  |  |       dashboard = { | 
					
						
							| 
									
										
										
										
											2022-12-25 12:20:20 +01:00
										 |  |  |         name = "Documents"; | 
					
						
							| 
									
										
										
										
											2022-11-09 22:17:13 +01:00
										 |  |  |         category = "media"; | 
					
						
							|  |  |  |         icon = "book"; | 
					
						
							| 
									
										
										
										
											2023-11-12 20:39:44 +01:00
										 |  |  |         url = "https://docs.${domain}"; | 
					
						
							| 
									
										
										
										
											2022-11-09 22:17:13 +01:00
										 |  |  |       }; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | } |