diff --git a/nixos/components/network/tinc/private.nix b/nixos/components/network/tinc/private.nix index 4bd9b10..d920fa2 100644 --- a/nixos/components/network/tinc/private.nix +++ b/nixos/components/network/tinc/private.nix @@ -24,6 +24,7 @@ let "sonarr.orbi" = hosts.orbi; "radarr.orbi" = hosts.orbi; "prowlarr.orbi" = hosts.orbi; + "photoprism.orbi" = hosts.orbi; # robi "grafana.robi" = hosts.robi; "loki.robi" = hosts.robi; diff --git a/nixos/homes/common/zfs.nix b/nixos/homes/common/zfs.nix index 66e5270..4b4b07b 100644 --- a/nixos/homes/common/zfs.nix +++ b/nixos/homes/common/zfs.nix @@ -10,6 +10,7 @@ with lib; options = [ "name" "mountpoint" + "compression" "com.sun:auto-snapshot:yearly" "com.sun:auto-snapshot:monthly" "com.sun:auto-snapshot:daily" diff --git a/nixos/machines/orbi/configuration.nix b/nixos/machines/orbi/configuration.nix index e0acde5..1d8fd81 100644 --- a/nixos/machines/orbi/configuration.nix +++ b/nixos/machines/orbi/configuration.nix @@ -13,6 +13,7 @@ ./service-forgejo.nix ./service-vaultwarden.nix ./service-taskserver.nix + #./service-photoprism.nix ./nginx-ingolf-wagner-de.nix ./nginx-wkd.nix diff --git a/nixos/machines/orbi/hardware-configuration/disko-config.nix b/nixos/machines/orbi/hardware-configuration/disko-config.nix index fc2c1a6..a3631bf 100644 --- a/nixos/machines/orbi/hardware-configuration/disko-config.nix +++ b/nixos/machines/orbi/hardware-configuration/disko-config.nix @@ -123,7 +123,7 @@ in canmount = "off"; }; datasets = { - "media" = { + media = { type = "zfs_fs"; mountpoint = "/media"; options = { @@ -134,6 +134,18 @@ in #"com.sun:auto-snapshot:monthly" = false; }; }; + #photoprism = { + # type = "zfs_fs"; + # mountpoint = "/var/lib/nixos-containers/photoprism"; + # options = { + # mountpoint = "legacy"; + # compression = "lz4"; + # "com.sun:auto-snapshot:hourly" = toString true; + # "com.sun:auto-snapshot:daily" = toString true; + # #"com.sun:auto-snapshot:weekly" = false; + # #"com.sun:auto-snapshot:monthly" = false; + # }; + #}; }; }; diff --git a/nixos/machines/orbi/service-photoprism.nix b/nixos/machines/orbi/service-photoprism.nix new file mode 100644 index 0000000..77a10f3 --- /dev/null +++ b/nixos/machines/orbi/service-photoprism.nix @@ -0,0 +1,63 @@ +{ config, pkgs, lib, ... }: +let + mySQLPackage = pkgs.mysql; + photoprismPort = 2342; + mysqlPort = 3336; +in +{ + + containers.photoprism = { + privateNetwork = false; + autoStart = true; + + config = { config, pkgs, lib, ... }: { + system.stateVersion = "23.11"; + + # Photoprism + # ---------- + services.photoprism = { + enable = true; + port = photoprismPort; + originalsPath = "/var/lib/private/photoprism/originals"; + address = "0.0.0.0"; + settings = { + PHOTOPRISM_ADMIN_USER = "admin"; + PHOTOPRISM_ADMIN_PASSWORD = "..."; + PHOTOPRISM_DEFAULT_LOCALE = "en"; + PHOTOPRISM_DATABASE_DRIVER = "mysql"; + PHOTOPRISM_DATABASE_NAME = "photoprism"; + PHOTOPRISM_DATABASE_SERVER = "/run/mysqld/mysqld.sock"; + PHOTOPRISM_DATABASE_USER = "photoprism"; + PHOTOPRISM_SITE_URL = "http://photoprism.orbi.private:${toString photoprismPort}"; + PHOTOPRISM_SITE_TITLE = "PhotoPrism"; + }; + }; + + # MySQL Database + # -------------- + services.mysql = { + enable = true; + package = mySQLPackage; + settings.mysqld.port = mysqlPort; + ensureDatabases = [ "photoprism" ]; + ensureUsers = [{ + name = "photoprism"; + ensurePermissions = { + "photoprism.*" = "ALL PRIVILEGES"; + }; + }]; + }; + + # Backup Database + # --------------- + services.mysqlBackup = { + enable = true; + databases = config.services.mysql.ensureDatabases; + singleTransaction = true; + }; + + }; + }; + + +}