2024-04-21 15:54:59 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
|
|
|
, makeWrapper
|
|
|
|
, temurin-jre-bin-11
|
|
|
|
, bash
|
|
|
|
, suitesparse
|
|
|
|
, nixosTests
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "photonvision";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "2024.3.1";
|
2024-04-21 15:54:59 +00:00
|
|
|
|
|
|
|
src = {
|
|
|
|
"x86_64-linux" = fetchurl {
|
|
|
|
url = "https://github.com/PhotonVision/photonvision/releases/download/v${version}/photonvision-v${version}-linuxx64.jar";
|
2024-05-15 15:35:15 +00:00
|
|
|
hash = "sha256-t9drkGFA3IurZqWAkzEaONVJkp5JHMEFBBW50r+SD68=";
|
2024-04-21 15:54:59 +00:00
|
|
|
};
|
|
|
|
"aarch64-linux" = fetchurl {
|
|
|
|
url = "https://github.com/PhotonVision/photonvision/releases/download/v${version}/photonvision-v${version}-linuxarm64.jar";
|
2024-05-15 15:35:15 +00:00
|
|
|
hash = "sha256-ninCVxse0x6lBA2NL3kwMeuHAeNzSa9rdP2dnmMNFgc=";
|
2024-04-21 15:54:59 +00:00
|
|
|
};
|
|
|
|
}.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
|
|
|
|
|
|
|
dontUnpack = true;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
install -D $src $out/lib/photonvision.jar
|
|
|
|
|
|
|
|
makeWrapper ${temurin-jre-bin-11}/bin/java $out/bin/photonvision \
|
|
|
|
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ stdenv.cc.cc.lib suitesparse ]} \
|
|
|
|
--prefix PATH : ${lib.makeBinPath [ temurin-jre-bin-11 bash.out ]} \
|
|
|
|
--add-flags "-jar $out/lib/photonvision.jar"
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru.tests = {
|
|
|
|
starts-web-server = nixosTests.photonvision;
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Free, fast, and easy-to-use computer vision solution for the FIRST Robotics Competition";
|
2024-04-21 15:54:59 +00:00
|
|
|
homepage = "https://photonvision.org/";
|
|
|
|
license = licenses.gpl3;
|
|
|
|
maintainers = with maintainers; [ max-niederman ];
|
|
|
|
mainProgram = "photonvision";
|
|
|
|
platforms = [ "x86_64-linux" "aarch64-linux" ];
|
|
|
|
};
|
|
|
|
}
|