2024-08-08 16:39:50 +02:00
{ config , pkgs , lib , components , . . . }:
2024-05-10 20:53:21 +02:00
let
mySQLPackage = pkgs . mysql ;
photoprismPort = 2342 ;
mysqlPort = 3336 ;
in
{
2024-05-10 23:17:45 +02:00
networking . firewall . interfaces . wg0 . allowedTCPPorts = [ photoprismPort ] ;
# networking.firewall.interfaces.wg0.allowedUDPPorts = [ photoprismPort ];
2024-05-10 20:53:21 +02:00
containers . photoprism = {
privateNetwork = false ;
autoStart = true ;
2024-05-18 12:02:21 +02:00
config = { config , lib , . . . }: {
nixpkgs . pkgs = pkgs ;
2024-08-08 16:39:50 +02:00
imports = [ " ${ components } / m o n i t o r / c o n t a i n e r . n i x " ] ;
2024-05-10 20:53:21 +02:00
system . stateVersion = " 2 3 . 1 1 " ;
2024-07-12 21:51:41 +02:00
services . logrotate . checkConfig = false ; # because uid 3000 does not exist in here
2024-05-10 20:53:21 +02:00
2024-08-23 07:51:07 +02:00
environment . systemPackages = [
config . services . photoprism . package
] ;
2024-05-10 20:53:21 +02:00
# Photoprism
# ----------
services . photoprism = {
enable = true ;
port = photoprismPort ;
2024-08-23 17:02:48 +02:00
package = pkgs . legacy_2405 . photoprism ;
2024-05-10 20:53:21 +02:00
originalsPath = " / v a r / l i b / p r i v a t e / p h o t o p r i s m / o r i g i n a l s " ;
address = " 0 . 0 . 0 . 0 " ;
settings = {
PHOTOPRISM_ADMIN_USER = " a d m i n " ;
2024-08-26 17:58:19 +02:00
PHOTOPRISM_ADMIN_PASSWORD = " . . . " ; # change me after initialisation
2024-05-10 20:53:21 +02:00
PHOTOPRISM_DEFAULT_LOCALE = " e n " ;
PHOTOPRISM_DATABASE_DRIVER = " m y s q l " ;
PHOTOPRISM_DATABASE_NAME = " p h o t o p r i s m " ;
PHOTOPRISM_DATABASE_SERVER = " / r u n / m y s q l d / m y s q l d . s o c k " ;
PHOTOPRISM_DATABASE_USER = " p h o t o p r i s m " ;
PHOTOPRISM_SITE_URL = " h t t p : / / p h o t o p r i s m . o r b i . p r i v a t e : ${ toString photoprismPort } " ;
PHOTOPRISM_SITE_TITLE = " P h o t o P r i s m " ;
2024-07-18 08:25:02 +02:00
PHOTOPRISM_UPLOAD_NSFW = " t r u e " ;
2024-08-27 17:03:22 +02:00
PHOTOPRISM_THUMB_UNCACHED = " f a l s e " ; # https://docs.photoprism.app/user-guide/settings/advanced/#static-and-dynamic-size-limits < prevents thumbs from beeing wrong orientation, but takes time for photo import.
2024-05-10 20:53:21 +02:00
} ;
} ;
# MySQL Database
# --------------
services . mysql = {
enable = true ;
package = mySQLPackage ;
settings . mysqld . port = mysqlPort ;
ensureDatabases = [ " p h o t o p r i s m " ] ;
ensureUsers = [ {
name = " p h o t o p r i s m " ;
ensurePermissions = {
" p h o t o p r i s m . * " = " A L L P R I V I L E G E S " ;
} ;
} ] ;
} ;
# Backup Database
# ---------------
services . mysqlBackup = {
enable = true ;
databases = config . services . mysql . ensureDatabases ;
singleTransaction = true ;
} ;
} ;
} ;
}