forked from jan-leila/nix-config
		
	created immich config
This commit is contained in:
		
							parent
							
								
									4b014ed29f
								
							
						
					
					
						commit
						3ec99b599b
					
				
					 4 changed files with 89 additions and 16 deletions
				
			
		|  | @ -114,6 +114,10 @@ | ||||||
|     adguardhome = { |     adguardhome = { | ||||||
|       enable = false; |       enable = false; | ||||||
|     }; |     }; | ||||||
|  |     immich = { | ||||||
|  |       enable = true; | ||||||
|  |       subdomain = "photos"; | ||||||
|  |     }; | ||||||
|     sync = { |     sync = { | ||||||
|       enable = true; |       enable = true; | ||||||
|       folders = { |       folders = { | ||||||
|  |  | ||||||
|  | @ -10,5 +10,6 @@ | ||||||
|     ./searx.nix |     ./searx.nix | ||||||
|     ./home-assistant.nix |     ./home-assistant.nix | ||||||
|     ./adguardhome.nix |     ./adguardhome.nix | ||||||
|  |     ./immich.nix | ||||||
|   ]; |   ]; | ||||||
| } | } | ||||||
|  |  | ||||||
							
								
								
									
										68
									
								
								modules/nixos-modules/server/immich.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								modules/nixos-modules/server/immich.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,68 @@ | ||||||
|  | { | ||||||
|  |   lib, | ||||||
|  |   config, | ||||||
|  |   ... | ||||||
|  | }: let | ||||||
|  |   mediaLocation = "/var/lib/immich"; | ||||||
|  | in { | ||||||
|  |   options.host.immich = { | ||||||
|  |     enable = lib.mkEnableOption "should immich be enabled on this computer"; | ||||||
|  |     subdomain = lib.mkOption { | ||||||
|  |       type = lib.types.str; | ||||||
|  |       description = "subdomain of base domain that immich will be hosted at"; | ||||||
|  |       default = "immich"; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|  | 
 | ||||||
|  |   config = lib.mkIf config.host.immich.enable (lib.mkMerge [ | ||||||
|  |     { | ||||||
|  |       host = { | ||||||
|  |         reverse_proxy.subdomains.${config.host.immich.subdomain} = { | ||||||
|  |           target = "http://localhost:${toString config.services.immich.port}"; | ||||||
|  |         }; | ||||||
|  |         postgres = { | ||||||
|  |           enable = true; | ||||||
|  |           extraUsers = { | ||||||
|  |             ${config.services.immich.database.user} = { | ||||||
|  |               isClient = true; | ||||||
|  |             }; | ||||||
|  |           }; | ||||||
|  |         }; | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       services.immich = { | ||||||
|  |         enable = true; | ||||||
|  |         port = 2283; | ||||||
|  |         # redis.enable = false; | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       networking.firewall.interfaces.${config.services.tailscale.interfaceName} = { | ||||||
|  |         allowedUDPPorts = [ | ||||||
|  |           config.services.immich.port | ||||||
|  |         ]; | ||||||
|  |         allowedTCPPorts = [ | ||||||
|  |           config.services.immich.port | ||||||
|  |         ]; | ||||||
|  |       }; | ||||||
|  |     } | ||||||
|  |     (lib.mkIf config.host.impermanence.enable { | ||||||
|  |       assertions = [ | ||||||
|  |         { | ||||||
|  |           assertion = config.services.immich.mediaLocation == mediaLocation; | ||||||
|  |           message = "immich media location does not match persistence"; | ||||||
|  |         } | ||||||
|  |       ]; | ||||||
|  |       environment.persistence."/persist/system/root" = { | ||||||
|  |         enable = true; | ||||||
|  |         hideMounts = true; | ||||||
|  |         directories = [ | ||||||
|  |           { | ||||||
|  |             directory = mediaLocation; | ||||||
|  |             user = "immich"; | ||||||
|  |             group = "immich"; | ||||||
|  |           } | ||||||
|  |         ]; | ||||||
|  |       }; | ||||||
|  |     }) | ||||||
|  |   ]); | ||||||
|  | } | ||||||
|  | @ -19,10 +19,10 @@ | ||||||
|     forgejo = 2002; |     forgejo = 2002; | ||||||
|     adguardhome = 2003; |     adguardhome = 2003; | ||||||
|     hass = 2004; |     hass = 2004; | ||||||
|     headscale = 2005; |  | ||||||
|     syncthing = 2007; |     syncthing = 2007; | ||||||
|     ollama = 2008; |     ollama = 2008; | ||||||
|     git = 2009; |     git = 2009; | ||||||
|  |     immich = 2010; | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   gids = { |   gids = { | ||||||
|  | @ -34,10 +34,10 @@ | ||||||
|     forgejo = 2002; |     forgejo = 2002; | ||||||
|     adguardhome = 2003; |     adguardhome = 2003; | ||||||
|     hass = 2004; |     hass = 2004; | ||||||
|     headscale = 2005; |  | ||||||
|     syncthing = 2007; |     syncthing = 2007; | ||||||
|     ollama = 2008; |     ollama = 2008; | ||||||
|     git = 2009; |     git = 2009; | ||||||
|  |     immich = 2010; | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   users = config.users.users; |   users = config.users.users; | ||||||
|  | @ -135,12 +135,6 @@ in { | ||||||
|             group = config.users.users.hass.name; |             group = config.users.users.hass.name; | ||||||
|           }; |           }; | ||||||
| 
 | 
 | ||||||
|           headscale = { |  | ||||||
|             uid = lib.mkForce uids.headscale; |  | ||||||
|             isSystemUser = true; |  | ||||||
|             group = config.users.users.headscale.name; |  | ||||||
|           }; |  | ||||||
| 
 |  | ||||||
|           syncthing = { |           syncthing = { | ||||||
|             uid = lib.mkForce uids.syncthing; |             uid = lib.mkForce uids.syncthing; | ||||||
|             isSystemUser = true; |             isSystemUser = true; | ||||||
|  | @ -159,6 +153,12 @@ in { | ||||||
|             isNormalUser = config.services.forgejo.enable; |             isNormalUser = config.services.forgejo.enable; | ||||||
|             group = config.users.users.git.name; |             group = config.users.users.git.name; | ||||||
|           }; |           }; | ||||||
|  | 
 | ||||||
|  |           immich = { | ||||||
|  |             uid = lib.mkForce uids.immich; | ||||||
|  |             isSystemUser = true; | ||||||
|  |             group = config.users.users.immich.name; | ||||||
|  |           }; | ||||||
|         }; |         }; | ||||||
| 
 | 
 | ||||||
|         groups = { |         groups = { | ||||||
|  | @ -225,14 +225,6 @@ in { | ||||||
|             ]; |             ]; | ||||||
|           }; |           }; | ||||||
| 
 | 
 | ||||||
|           headscale = { |  | ||||||
|             gid = lib.mkForce gids.headscale; |  | ||||||
|             members = [ |  | ||||||
|               users.headscale.name |  | ||||||
|               # leyla |  | ||||||
|             ]; |  | ||||||
|           }; |  | ||||||
| 
 |  | ||||||
|           syncthing = { |           syncthing = { | ||||||
|             gid = lib.mkForce gids.syncthing; |             gid = lib.mkForce gids.syncthing; | ||||||
|             members = [ |             members = [ | ||||||
|  | @ -255,6 +247,14 @@ in { | ||||||
|               users.git.name |               users.git.name | ||||||
|             ]; |             ]; | ||||||
|           }; |           }; | ||||||
|  | 
 | ||||||
|  |           immich = { | ||||||
|  |             gid = lib.mkForce gids.immich; | ||||||
|  |             members = [ | ||||||
|  |               users.immich.name | ||||||
|  |               # leyla | ||||||
|  |             ]; | ||||||
|  |           }; | ||||||
|         }; |         }; | ||||||
|       }; |       }; | ||||||
|     } |     } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue