nixpkgs/pkgs/servers/tvheadend/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

83 lines
2.5 KiB
Nix

{ lib, stdenv, fetchFromGitHub, cmake, makeWrapper, pkgconfig
, avahi, dbus, gettext, git, gnutar, gzip, bzip2, ffmpeg_3, libiconv, openssl, python
, v4l-utils, which, zlib }:
let
version = "4.2.8";
dtv-scan-tables = stdenv.mkDerivation {
pname = "dtv-scan-tables";
version = "2020-05-18";
src = fetchFromGitHub {
owner = "tvheadend";
repo = "dtv-scan-tables";
rev = "e3138a506a064f6dfd0639d69f383e8e576609da";
sha256 = "19ac9ds3rfc2xrqcywsbd1iwcpv7vmql7gp01iikxkzcgm2g2b6w";
};
nativeBuildInputs = [ v4l-utils ];
installFlags = [ "DATADIR=$(out)" ];
};
in stdenv.mkDerivation {
pname = "tvheadend";
inherit version;
src = fetchFromGitHub {
owner = "tvheadend";
repo = "tvheadend";
rev = "v${version}";
sha256 = "1xq059r2bplaa0nd0wkhw80jfwd962x0h5hgd7fz2yp6largw34m";
};
buildInputs = [
avahi dbus gettext git gnutar gzip bzip2 ffmpeg_3 libiconv openssl python
which zlib
];
nativeBuildInputs = [ cmake makeWrapper pkgconfig ];
NIX_CFLAGS_COMPILE = [ "-Wno-error=format-truncation" "-Wno-error=stringop-truncation" ];
# disable dvbscan, as having it enabled causes a network download which
# cannot happen during build. We now include the dtv-scan-tables ourselves
configureFlags = [
"--disable-dvbscan"
"--disable-bintray_cache"
"--disable-ffmpeg_static"
"--disable-hdhomerun_client"
"--disable-hdhomerun_static"
];
dontUseCmakeConfigure = true;
preConfigure = ''
patchShebangs ./configure
substituteInPlace src/config.c \
--replace /usr/bin/tar ${gnutar}/bin/tar
substituteInPlace src/input/mpegts/scanfile.c \
--replace /usr/share/dvb ${dtv-scan-tables}/dvbv5
# 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 = with lib; {
description = "TV streaming server";
longDescription = ''
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 = with maintainers; [ simonvandel ];
};
}