summary refs log tree commit diff
path: root/pkgs/servers/tvheadend
diff options
context:
space:
mode:
authorPeter Hoeg <peter@hoeg.com>2017-11-01 17:41:21 +0800
committerPeter Hoeg <peter@hoeg.com>2017-11-01 17:41:39 +0800
commitaf0c3fca1de900de881f19a1fae3806ea34427cc (patch)
treefd1130ee981f3ec85e95fd5dad19de6358dc9ae9 /pkgs/servers/tvheadend
parent06d7e54d62cfa303057ad65d86311cdce6f8c9bf (diff)
downloadnixpkgs-af0c3fca1de900de881f19a1fae3806ea34427cc.tar
nixpkgs-af0c3fca1de900de881f19a1fae3806ea34427cc.tar.gz
nixpkgs-af0c3fca1de900de881f19a1fae3806ea34427cc.tar.bz2
nixpkgs-af0c3fca1de900de881f19a1fae3806ea34427cc.tar.lz
nixpkgs-af0c3fca1de900de881f19a1fae3806ea34427cc.tar.xz
nixpkgs-af0c3fca1de900de881f19a1fae3806ea34427cc.tar.zst
nixpkgs-af0c3fca1de900de881f19a1fae3806ea34427cc.zip
tvheadend: fix version detection and wrap bzip2 to support backups
Diffstat (limited to 'pkgs/servers/tvheadend')
-rw-r--r--pkgs/servers/tvheadend/default.nix52
1 files changed, 31 insertions, 21 deletions
diff --git a/pkgs/servers/tvheadend/default.nix b/pkgs/servers/tvheadend/default.nix
index 851149ad7f7..7ff0796811a 100644
--- a/pkgs/servers/tvheadend/default.nix
+++ b/pkgs/servers/tvheadend/default.nix
@@ -1,20 +1,26 @@
-{avahi, cmake, dbus, fetchurl, gettext, git, gnutar, gzip, bzip2, ffmpeg, libiconv, openssl, pkgconfig, python
-, stdenv, which, zlib}:
+{ stdenv, fetchFromGitHub, cmake, makeWrapper, pkgconfig
+, avahi, dbus, gettext, git, gnutar, gzip, bzip2, ffmpeg, libiconv, openssl, python
+, which, zlib }:
 
-with stdenv.lib;
+let
+  version = "4.2.1";
 
-let version = "4.2.1";
-    pkgName = "tvheadend";
+in stdenv.mkDerivation rec {
+  name = "tvheadend-${version}";
 
-in
+  src = fetchFromGitHub {
+    owner  = "tvheadend";
+    repo   = "tvheadend";
+    rev    = "v${version}";
+    sha256 = "1lhk8psvifmn4kjwyfxjj21z0apyr59zizzsfd4j22v7bk66rrl9";
+  };
 
-stdenv.mkDerivation rec {
-  name = "${pkgName}-${version}";
+  buildInputs = [
+    avahi dbus gettext git gnutar gzip bzip2 ffmpeg libiconv openssl python
+    which zlib
+  ];
 
-  src = fetchurl {
-    url = "https://github.com/tvheadend/tvheadend/archive/v${version}.tar.gz";
-    sha256 = "1wrj3w595c1hfl2vmfdmp5qncy5samqi7iisyq76jf3nlzgw6dvn";
-  };
+  nativeBuildInputs = [ cmake makeWrapper pkgconfig ];
 
   enableParallelBuilding = true;
 
@@ -28,28 +34,32 @@ stdenv.mkDerivation rec {
     "--disable-hdhomerun_static"
   ];
 
-  buildPhase = "make";
-
   dontUseCmakeConfigure = true;
 
-  nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ avahi dbus cmake gettext git gnutar gzip bzip2 ffmpeg libiconv openssl python
-    which zlib ];
-
   preConfigure = ''
     patchShebangs ./configure
+
     substituteInPlace src/config.c --replace /usr/bin/tar ${gnutar}/bin/tar
+
+    # the version detection script `support/version` reads this file if it
+    # exists, so let's just use that
+    echo ${version} > rpm/version
+  '';
+
+  postInstall = ''
+    wrapProgram $out/bin/tvheadend \
+      --prefix PATH : ${stdenv.lib.makeBinPath [ bzip2 ]}
   '';
 
-  meta = {
+  meta = with stdenv.lib; {
     description = "TV streaming server";
     longDescription = ''
-	Tvheadend is a TV streaming server and recorder for Linux, FreeBSD and Android 
+	Tvheadend is a TV streaming server and recorder for Linux, FreeBSD and Android
         supporting DVB-S, DVB-S2, DVB-C, DVB-T, ATSC, IPTV, SAT>IP and HDHomeRun as input sources.
 	Tvheadend offers the HTTP (VLC, MPlayer), HTSP (Kodi, Movian) and SAT>IP streaming.'';
     homepage = https://tvheadend.org;
     license = licenses.gpl3;
     platforms = platforms.unix;
-    maintainers = [ maintainers.simonvandel ];
+    maintainers = with maintainers; [ simonvandel ];
   };
 }