From d1d0793e2ca5af00b3829f2166b10953028050b5 Mon Sep 17 00:00:00 2001 From: Giulio De Pasquale Date: Mon, 5 Jun 2023 03:15:23 +0200 Subject: [PATCH] photoprism: use vhost --- hosts/architect/photoprism.nix | 37 ++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 hosts/architect/photoprism.nix diff --git a/hosts/architect/photoprism.nix b/hosts/architect/photoprism.nix new file mode 100644 index 0000000..38ef065 --- /dev/null +++ b/hosts/architect/photoprism.nix @@ -0,0 +1,37 @@ +{ config, pkgs, lib, ... }: + +let + domain = "photos.giugl.io"; +in +{ + services = { + photoprism = { + enable = true; + package = pkgs.photoprism; + originalsPath = "/var/lib/private/photoprism/originals"; + address = "0.0.0.0"; + settings = { + 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 = "https://${domain}"; + PHOTOPRISM_SITE_TITLE = "PePrism"; + PHOTOPRISM_FFMPEG_ENCODER = "nvidia"; + PHOTOPRISM_INIT = "tensorflow"; + NVIDIA_VISIBLE_DEVICES = "all"; + NVIDIA_DRIVER_CAPABILITIES = "compute,video,utility"; + PHOTOPRISM_FFMPEG_BIN = "${pkgs.ffmpeg}/bin/ffmpeg"; + }; + }; + + architect.vhost.${domain} = { + dnsInterfaces = [ "tailscale" "lan" ]; + locations."/" = { + port = config.services.photoprism.port; + allowLan = true; + allow = [ config.architect.networks."tailscale".net ]; + }; + }; + }