Files
nixpkgs/pkgs/by-name/ph/photoprism/backend.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

64 lines
1.4 KiB
Nix

{
lib,
buildGoModule,
coreutils,
python3,
src,
version,
pkg-config,
vips,
symlinkJoin,
}:
let
# we need to copy these, to add the symlinks, so the linker actually finds these libraries
libtensorflow = symlinkJoin {
name = "libtensorflow";
paths = [ "${python3.pkgs.tensorflow-bin}/${python3.sitePackages}/tensorflow" ];
postBuild = ''
ln -s "$out/libtensorflow_cc.so.2" "$out/libtensorflow.so"
ln -s "$out/libtensorflow_framework.so.2" "$out/libtensorflow_framework.so"
'';
};
in
buildGoModule {
inherit src version;
pname = "photoprism-backend";
nativeBuildInputs = [
pkg-config
];
buildInputs = [
coreutils
libtensorflow
vips
];
ldflags = [
"-s"
"-w"
"-X main.version=${version}"
];
postPatch = ''
substituteInPlace internal/commands/passwd.go --replace-fail '/bin/stty' "${coreutils}/bin/stty"
'';
vendorHash = "sha256-8uy0uLhGOyedqi3AvMsEdDQnFvGgeeZcL4tFgI6bzU8=";
subPackages = [ "cmd/photoprism" ];
# https://github.com/mattn/go-sqlite3/issues/822
CGO_CFLAGS = "-Wno-return-local-addr -I${libtensorflow}/include";
CGO_LDFLAGS = "-L${libtensorflow} -ltensorflow_framework";
meta = with lib; {
homepage = "https://photoprism.app";
description = "Photoprism's backend";
license = licenses.agpl3Only;
maintainers = with maintainers; [ benesim ];
};
}