diff --git a/flake.nix b/flake.nix index df5438c..84b284a 100644 --- a/flake.nix +++ b/flake.nix @@ -167,6 +167,11 @@ }) ]; }; + photoprismOverlay = final: prev: { + photoprism = final.callPackage ./pkgs/photoprism/package.nix { + photoprism = prev.photoprism; + }; + }; desktopCompatibilityOverlay = _: prev: { codex = let @@ -271,6 +276,7 @@ desktopCompatibilityOverlay pyfilesystemOverlay spacedriveOverlay + photoprismOverlay ]; networking.hostName = "fern"; imports = [ ./servers/fern/hardware-configuration.nix ]; diff --git a/pkgs/photoprism/package.nix b/pkgs/photoprism/package.nix new file mode 100644 index 0000000..5babf6a --- /dev/null +++ b/pkgs/photoprism/package.nix @@ -0,0 +1,30 @@ +{ + fetchurl, + fetchzip, + photoprism, +}: + +let + scrfd = fetchurl { + url = "https://raw.githubusercontent.com/laolaolulu/FaceTrain/master/model/scrfd/scrfd_500m_bnkps_shape640x640.onnx"; + hash = "sha256-rnIYVlPieaogVrKIZioZ7DUZztVCbSre/74FioY2miQ="; + }; + + onnxruntime = fetchzip { + url = "https://github.com/microsoft/onnxruntime/releases/download/v1.26.0/onnxruntime-linux-x64-1.26.0.tgz"; + hash = "sha256-pSA5JzCpVYMhP0r2l2pyYXhgBYtPOOCEKY0eG9TnXCM="; + }; +in +photoprism.overrideAttrs (old: { + postInstall = (old.postInstall or "") + '' + mkdir -p "$out/share/photoprism/models/scrfd" + ln -s ${scrfd} "$out/share/photoprism/models/scrfd/scrfd.onnx" + + wrapProgram "$out/bin/photoprism" \ + --prefix LD_LIBRARY_PATH : "${onnxruntime}/lib" + ''; + + passthru = (old.passthru or { }) // { + inherit onnxruntime scrfd; + }; +}) diff --git a/servers/ui-mode/configuration.nix b/servers/ui-mode/configuration.nix index 891ad56..d48efcd 100644 --- a/servers/ui-mode/configuration.nix +++ b/servers/ui-mode/configuration.nix @@ -336,6 +336,7 @@ mesa libxkbcommon openssl + icu libGL libva libelf