2024-03-04 09:26:16 +08:00
|
|
|
{ lib
|
|
|
|
, pkg-config
|
|
|
|
, libjpeg_turbo
|
|
|
|
, libheif
|
|
|
|
, lapack
|
|
|
|
, dlib
|
|
|
|
, blas
|
|
|
|
, ffmpeg
|
|
|
|
, exiftool
|
|
|
|
, darktable
|
|
|
|
, fetchFromGitHub
|
|
|
|
, buildGoModule
|
|
|
|
, buildNpmPackage
|
2024-03-04 12:07:20 +08:00
|
|
|
, runCommandLocal
|
2024-03-04 09:26:16 +08:00
|
|
|
, makeWrapper }: buildGoModule rec {
|
|
|
|
pname = "photoview";
|
|
|
|
version = "2.3.13";
|
|
|
|
|
|
|
|
source = fetchFromGitHub {
|
|
|
|
name = "${pname}-src";
|
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-O6k5nbiWTsuOi8YLX0rsZJ9dOIo5d6pdwjhFZrdwI0E=";
|
|
|
|
};
|
|
|
|
|
|
|
|
src = source + "/api";
|
|
|
|
vendorHash = "sha256-0SWywy9YdPtgvxRhwKhKvspPmhbnibSuhvzhsjIQvZk=";
|
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
makeWrapper
|
|
|
|
];
|
|
|
|
buildInputs = [
|
|
|
|
libjpeg_turbo
|
|
|
|
libheif
|
|
|
|
lapack
|
|
|
|
dlib
|
|
|
|
blas
|
|
|
|
];
|
|
|
|
|
|
|
|
ui = buildNpmPackage {
|
|
|
|
pname = "${pname}-ui";
|
|
|
|
inherit version;
|
|
|
|
src = source + "/ui";
|
2024-03-04 12:07:20 +08:00
|
|
|
|
|
|
|
#REACT_APP_API_ENDPOINT = "";
|
|
|
|
REACT_APP_BUILD_VERSION = version;
|
|
|
|
REACT_APP_BUILD_DATE = builtins.readFile (runCommandLocal "date" { } "date -uI > $out" );
|
|
|
|
REACT_APP_BUILD_COMMIT_SHA = "nix";
|
|
|
|
|
2024-03-04 09:26:16 +08:00
|
|
|
npmDepsHash = "sha256-31CyjyNd85hNg4MXIWctoQ3YgorGqCMz+wDAu/K1lWo=";
|
|
|
|
};
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p "$out/lib/${pname}"
|
2024-03-04 12:07:20 +08:00
|
|
|
|
|
|
|
mv "$out/bin/api" "$out/bin/${pname}"
|
2024-03-04 09:26:16 +08:00
|
|
|
wrapProgram $out/bin/${pname} \
|
|
|
|
--prefix PATH ":" "${lib.makeBinPath [
|
|
|
|
ffmpeg
|
|
|
|
exiftool
|
|
|
|
darktable
|
|
|
|
]}" \
|
|
|
|
--set PHOTOVIEW_SERVE_UI 1 \
|
|
|
|
--set PHOTOVIEW_UI_PATH "$out/lib/${pname}/ui"
|
2024-03-04 12:07:20 +08:00
|
|
|
cp -r \
|
|
|
|
"${src}/data/" \
|
|
|
|
"$out/lib/${pname}/data/"
|
2024-03-04 09:26:16 +08:00
|
|
|
|
|
|
|
cp -r \
|
|
|
|
"${ui}/lib/node_modules/photoview-ui/dist" \
|
|
|
|
"$out/lib/${pname}/ui"
|
|
|
|
'';
|
|
|
|
}
|