tvheadend: fix version detection and wrap bzip2 to support backups

+31 -21
+31 -21
pkgs/servers/tvheadend/default.nix
··· 1 - {avahi, cmake, dbus, fetchurl, gettext, git, gnutar, gzip, bzip2, ffmpeg, libiconv, openssl, pkgconfig, python 2 - , stdenv, which, zlib}: 1 + { stdenv, fetchFromGitHub, cmake, makeWrapper, pkgconfig 2 + , avahi, dbus, gettext, git, gnutar, gzip, bzip2, ffmpeg, libiconv, openssl, python 3 + , which, zlib }: 3 4 4 - with stdenv.lib; 5 + let 6 + version = "4.2.1"; 5 7 6 - let version = "4.2.1"; 7 - pkgName = "tvheadend"; 8 + in stdenv.mkDerivation rec { 9 + name = "tvheadend-${version}"; 8 10 9 - in 11 + src = fetchFromGitHub { 12 + owner = "tvheadend"; 13 + repo = "tvheadend"; 14 + rev = "v${version}"; 15 + sha256 = "1lhk8psvifmn4kjwyfxjj21z0apyr59zizzsfd4j22v7bk66rrl9"; 16 + }; 10 17 11 - stdenv.mkDerivation rec { 12 - name = "${pkgName}-${version}"; 18 + buildInputs = [ 19 + avahi dbus gettext git gnutar gzip bzip2 ffmpeg libiconv openssl python 20 + which zlib 21 + ]; 13 22 14 - src = fetchurl { 15 - url = "https://github.com/tvheadend/tvheadend/archive/v${version}.tar.gz"; 16 - sha256 = "1wrj3w595c1hfl2vmfdmp5qncy5samqi7iisyq76jf3nlzgw6dvn"; 17 - }; 23 + nativeBuildInputs = [ cmake makeWrapper pkgconfig ]; 18 24 19 25 enableParallelBuilding = true; 20 26 ··· 28 34 "--disable-hdhomerun_static" 29 35 ]; 30 36 31 - buildPhase = "make"; 32 - 33 37 dontUseCmakeConfigure = true; 34 38 35 - nativeBuildInputs = [ pkgconfig ]; 36 - buildInputs = [ avahi dbus cmake gettext git gnutar gzip bzip2 ffmpeg libiconv openssl python 37 - which zlib ]; 38 - 39 39 preConfigure = '' 40 40 patchShebangs ./configure 41 + 41 42 substituteInPlace src/config.c --replace /usr/bin/tar ${gnutar}/bin/tar 43 + 44 + # the version detection script `support/version` reads this file if it 45 + # exists, so let's just use that 46 + echo ${version} > rpm/version 47 + ''; 48 + 49 + postInstall = '' 50 + wrapProgram $out/bin/tvheadend \ 51 + --prefix PATH : ${stdenv.lib.makeBinPath [ bzip2 ]} 42 52 ''; 43 53 44 - meta = { 54 + meta = with stdenv.lib; { 45 55 description = "TV streaming server"; 46 56 longDescription = '' 47 - Tvheadend is a TV streaming server and recorder for Linux, FreeBSD and Android 57 + Tvheadend is a TV streaming server and recorder for Linux, FreeBSD and Android 48 58 supporting DVB-S, DVB-S2, DVB-C, DVB-T, ATSC, IPTV, SAT>IP and HDHomeRun as input sources. 49 59 Tvheadend offers the HTTP (VLC, MPlayer), HTSP (Kodi, Movian) and SAT>IP streaming.''; 50 60 homepage = https://tvheadend.org; 51 61 license = licenses.gpl3; 52 62 platforms = platforms.unix; 53 - maintainers = [ maintainers.simonvandel ]; 63 + maintainers = with maintainers; [ simonvandel ]; 54 64 }; 55 65 }