forked from jan-leila/nix-config
		
	main #5
					 4 changed files with 75 additions and 0 deletions
				
			
		|  | @ -284,6 +284,11 @@ | |||
|       subdomain = "search"; | ||||
|     }; | ||||
| 
 | ||||
|     actual = { | ||||
|       enable = true; | ||||
|       subdomain = "budget"; | ||||
|     }; | ||||
| 
 | ||||
|     home-assistant = { | ||||
|       enable = true; | ||||
|       subdomain = "home"; | ||||
|  |  | |||
							
								
								
									
										54
									
								
								modules/nixos-modules/server/actual.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								modules/nixos-modules/server/actual.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,54 @@ | |||
| { | ||||
|   lib, | ||||
|   config, | ||||
|   ... | ||||
| }: let | ||||
|   dataDirectory = "/var/lib/actual/"; | ||||
| in { | ||||
|   options.services.actual = { | ||||
|     subdomain = lib.mkOption { | ||||
|       type = lib.types.str; | ||||
|       default = "actual"; | ||||
|       description = "subdomain of base domain that actual will be hosted at"; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config = lib.mkIf config.services.actual.enable (lib.mkMerge [ | ||||
|     { | ||||
|       systemd.tmpfiles.rules = [ | ||||
|         "d ${dataDirectory} 2770 actual actual" | ||||
|       ]; | ||||
|       host = { | ||||
|         reverse_proxy.subdomains.${config.services.actual.subdomain} = { | ||||
|           target = "http://localhost:${toString config.services.actual.settings.port}"; | ||||
|         }; | ||||
|       }; | ||||
| 
 | ||||
|       services.actual = { | ||||
|         settings = { | ||||
|           ACTUAL_DATA_DIR = dataDirectory; | ||||
|         }; | ||||
|       }; | ||||
|     } | ||||
|     (lib.mkIf config.services.fail2ban.enable { | ||||
|       # TODO: configuration for fail2ban for actual | ||||
|     }) | ||||
|     (lib.mkIf config.host.impermanence.enable { | ||||
|       assertions = [ | ||||
|         { | ||||
|           assertion = config.services.actual.settings.ACTUAL_DATA_DIR == dataDirectory; | ||||
|           message = "actual data location does not match persistence"; | ||||
|         } | ||||
|       ]; | ||||
|       environment.persistence."/persist/system/root" = { | ||||
|         directories = [ | ||||
|           { | ||||
|             directory = dataDirectory; | ||||
|             user = "actual"; | ||||
|             group = "actual"; | ||||
|           } | ||||
|         ]; | ||||
|       }; | ||||
|     }) | ||||
|   ]); | ||||
| } | ||||
|  | @ -13,5 +13,6 @@ | |||
|     ./immich.nix | ||||
|     ./qbittorent.nix | ||||
|     ./paperless.nix | ||||
|     ./actual.nix | ||||
|   ]; | ||||
| } | ||||
|  |  | |||
|  | @ -24,6 +24,7 @@ | |||
|     immich = 2010; | ||||
|     qbittorrent = 2011; | ||||
|     paperless = 2012; | ||||
|     actual = 2013; | ||||
|   }; | ||||
| 
 | ||||
|   gids = { | ||||
|  | @ -40,6 +41,7 @@ | |||
|     immich = 2010; | ||||
|     qbittorrent = 2011; | ||||
|     paperless = 2012; | ||||
|     actual = 2013; | ||||
|   }; | ||||
| 
 | ||||
|   users = config.users.users; | ||||
|  | @ -169,6 +171,12 @@ in { | |||
|             isSystemUser = true; | ||||
|             group = config.users.users.paperless.name; | ||||
|           }; | ||||
| 
 | ||||
|           actual = { | ||||
|             uid = lib.mkForce uids.actual; | ||||
|             isSystemUser = true; | ||||
|             group = config.users.users.actual.name; | ||||
|           }; | ||||
|         }; | ||||
| 
 | ||||
|         groups = { | ||||
|  | @ -272,6 +280,13 @@ in { | |||
|               users.paperless.name | ||||
|             ]; | ||||
|           }; | ||||
| 
 | ||||
|           actual = { | ||||
|             gid = lib.mkForce gids.actual; | ||||
|             members = [ | ||||
|               users.actual.name | ||||
|             ]; | ||||
|           }; | ||||
|         }; | ||||
|       }; | ||||
|     } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue