2023-05-31 20:41:34 +00:00
|
|
|
{ lib
|
|
|
|
, fetchFromGitHub
|
2024-05-28 07:36:56 +00:00
|
|
|
, fetchpatch
|
2023-05-31 20:41:34 +00:00
|
|
|
, buildGoModule
|
|
|
|
, buildNpmPackage
|
|
|
|
, makeWrapper
|
|
|
|
, exiftool
|
|
|
|
, ffmpeg
|
2023-11-23 12:11:19 +00:00
|
|
|
, testers
|
|
|
|
, photofield
|
2023-05-31 20:41:34 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2023-11-23 12:10:55 +00:00
|
|
|
version = "0.13.0";
|
2023-05-31 20:41:34 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "SmilyOrg";
|
|
|
|
repo = "photofield";
|
2023-11-23 12:10:55 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-6pJvOn3sN6zfjt2dVZ/xH6pSXM0WgbG7au9tSVUGYys=";
|
2023-05-31 20:41:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
webui = buildNpmPackage {
|
|
|
|
inherit src version;
|
|
|
|
pname = "photofield-ui";
|
|
|
|
|
2023-07-25 13:27:31 +00:00
|
|
|
sourceRoot = "${src.name}/ui";
|
2023-05-31 20:41:34 +00:00
|
|
|
|
2023-11-23 12:10:55 +00:00
|
|
|
npmDepsHash = "sha256-trKcNuhRdiabFKMafOLtPg8x1bQHLOif6Hm4k5bTAYc=";
|
2023-05-31 20:41:34 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/share
|
|
|
|
mv dist $out/share/photofield-ui
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
in
|
|
|
|
|
2024-05-28 07:36:56 +00:00
|
|
|
buildGoModule {
|
2023-05-31 20:41:34 +00:00
|
|
|
pname = "photofield";
|
|
|
|
inherit version src;
|
|
|
|
|
2024-05-28 07:36:56 +00:00
|
|
|
patches = [
|
|
|
|
# Needed for Go 1.22 build support
|
|
|
|
(fetchpatch {
|
|
|
|
name = "upgrade-pyroscope-go.patch";
|
|
|
|
url = "https://github.com/SmilyOrg/photofield/commit/681dcd48ab4113b0e99fe1a0d3638f0dfe985c05.patch";
|
|
|
|
hash = "sha256-JGb5KAI/SmR1kiiaPoSsAF7G4YWDFXj0K3Gjw0zA3Ro=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
vendorHash = "sha256-BnImE4wK2MDO21N5tT9Q9w+NkDpdBCEqUwzuH/xb6fg=";
|
2023-05-31 20:41:34 +00:00
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
cp -r ${webui}/share/photofield-ui ui/dist
|
|
|
|
'';
|
|
|
|
|
|
|
|
ldflags = [
|
|
|
|
"-s"
|
|
|
|
"-w"
|
|
|
|
"-X main.version=${version}"
|
|
|
|
"-X main.builtBy=Nix"
|
|
|
|
];
|
|
|
|
|
2023-11-23 12:10:55 +00:00
|
|
|
tags = [ "embedui" ];
|
2023-05-31 20:41:34 +00:00
|
|
|
|
|
|
|
doCheck = false; # tries to modify filesytem
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
wrapProgram $out/bin/photofield \
|
|
|
|
--prefix PATH : "${lib.makeBinPath [exiftool ffmpeg]}"
|
|
|
|
'';
|
|
|
|
|
2023-11-23 12:11:19 +00:00
|
|
|
passthru.tests.version = testers.testVersion {
|
|
|
|
package = photofield;
|
|
|
|
command = "photofield -version";
|
|
|
|
};
|
|
|
|
|
2023-05-31 20:41:34 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Experimental fast photo viewer";
|
|
|
|
homepage = "https://github.com/SmilyOrg/photofield";
|
|
|
|
license = licenses.mit;
|
2023-11-23 12:11:31 +00:00
|
|
|
mainProgram = "photofield";
|
2023-05-31 20:41:34 +00:00
|
|
|
maintainers = with maintainers; [ dit7ya ];
|
|
|
|
};
|
|
|
|
}
|