nixos/package/photoview/default.nix

64 lines
1.2 KiB
Nix
Raw Normal View History

2024-03-04 09:26:16 +08:00
{ lib
, pkg-config
, libjpeg_turbo
, libheif
, lapack
, dlib
, blas
, ffmpeg
, exiftool
, darktable
, fetchFromGitHub
, buildGoModule
, buildNpmPackage
, 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";
npmDepsHash = "sha256-31CyjyNd85hNg4MXIWctoQ3YgorGqCMz+wDAu/K1lWo=";
};
postInstall = ''
mv "$out/bin/api" "$out/bin/${pname}"
mkdir -p "$out/lib/${pname}"
wrapProgram $out/bin/${pname} \
--prefix PATH ":" "${lib.makeBinPath [
ffmpeg
exiftool
darktable
]}" \
--set PHOTOVIEW_SERVE_UI 1 \
--set PHOTOVIEW_UI_PATH "$out/lib/${pname}/ui"
cp -r \
"${ui}/lib/node_modules/photoview-ui/dist" \
"$out/lib/${pname}/ui"
'';
}