summary refs log tree commit diff
path: root/pkgs/servers/unifi-video/default.nix
blob: 4c55d5102591116523bd6183df12871cc5879643 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{ dpkg
, stdenv
, lib
, fetchurl
, jre8
, jsvc
, lsb-release
, libcap
, util-linux
, makeWrapper
, autoPatchelfHook
, glibc
, gcc-unwrapped
}:

stdenv.mkDerivation rec {
  pname = "unifi-video";
  version = "3.10.13";
  src = fetchurl {
    urls = [ "https://dl.ui.com/firmwares/ufv/v${version}/unifi-video.Debian9_amd64.v${version}.deb" "https://archive.org/download/unifi-video.Debian9_amd64.v${version}/unifi-video.Debian9_amd64.v${version}.deb" ];
    sha256 = "06mxjdizs4mhm1by8kj4pg5hhdi8ns6x75ggwyp1k6zb26jvvdny";
  };

  buildInputs = [ jre8 jsvc lsb-release libcap util-linux ];
  nativeBuildInputs = [ dpkg makeWrapper autoPatchelfHook glibc gcc-unwrapped ];

  unpackCmd = ''
    runHook preUnpack

    dpkg-deb -x $src .
    rm -r etc

    runHook postUnpack
  '';

  installPhase = ''
    runHook preInstall

    mkdir -p $out
    cp -ar sbin $out/bin
    cp -ar lib share $out
    chmod +x $out/bin/*
    wrapProgram $out/bin/unifi-video --set JAVA_HOME "${jre8}" --prefix PATH : ${lib.makeBinPath [ jre8 lsb-release libcap util-linux]}

    runHook postInstall
  '';

  meta = with lib; {
    description = "Unifi Video NVR (aka Airvision) is a software package for controlling Unifi cameras";
    longDescription = ''
      Unifi Video is the NVR server software which can monitor and
      record footage from supported Unifi video cameras
    '';
    homepage = "https://www.ui.com";
    downloadPage = "https://www.ui.com/download/unifi-video/";
    license = licenses.unfree;
    maintainers = [ maintainers.rsynnest ];
    platforms = [ "x86_64-linux" ];
    knownVulnerabilities = [ "Upstream support for Unifi Video ended January 1st, 2021." ];
  };
}