silx: 2.1.1 -> 2.1.2 (#361612)
[NixPkgs.git] / pkgs / by-name / ph / photonvision / package.nix
blob09330c9c442b5fc155c15f995fe0dc793aeed127
1 { lib
2 , stdenv
3 , fetchurl
4 , makeWrapper
5 , temurin-jre-bin-11
6 , bash
7 , suitesparse
8 , nixosTests
9 }:
11 stdenv.mkDerivation rec {
12   pname = "photonvision";
13   version = "2024.3.1";
15   src = {
16     "x86_64-linux" = fetchurl {
17       url = "https://github.com/PhotonVision/photonvision/releases/download/v${version}/photonvision-v${version}-linuxx64.jar";
18       hash = "sha256-t9drkGFA3IurZqWAkzEaONVJkp5JHMEFBBW50r+SD68=";
19     };
20     "aarch64-linux" = fetchurl {
21       url = "https://github.com/PhotonVision/photonvision/releases/download/v${version}/photonvision-v${version}-linuxarm64.jar";
22       hash = "sha256-ninCVxse0x6lBA2NL3kwMeuHAeNzSa9rdP2dnmMNFgc=";
23     };
24   }.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
26   dontUnpack = true;
28   nativeBuildInputs = [ makeWrapper ];
30   installPhase = ''
31     runHook preInstall
33     install -D $src $out/lib/photonvision.jar
35     makeWrapper ${temurin-jre-bin-11}/bin/java $out/bin/photonvision \
36       --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ stdenv.cc.cc suitesparse ]} \
37       --prefix PATH : ${lib.makeBinPath [ temurin-jre-bin-11 bash.out ]} \
38       --add-flags "-jar $out/lib/photonvision.jar"
40     runHook postInstall
41   '';
43   passthru.tests = {
44     starts-web-server = nixosTests.photonvision;
45   };
47   meta = with lib; {
48     description = "Free, fast, and easy-to-use computer vision solution for the FIRST Robotics Competition";
49     homepage = "https://photonvision.org/";
50     license = licenses.gpl3;
51     maintainers = with maintainers; [ max-niederman ];
52     mainProgram = "photonvision";
53     platforms = [ "x86_64-linux" "aarch64-linux" ];
54   };