parent
5ee8b66a68
commit
9dab1a840c
@ -0,0 +1,61 @@ |
||||
{ config, coreutils, lib, pkgs, ... }: |
||||
|
||||
with lib; |
||||
|
||||
let cfg = config.services.tvheadend; |
||||
pidFile = "${config.users.extraUsers.tvheadend.home}/tvheadend.pid"; |
||||
in |
||||
|
||||
{ |
||||
options = { |
||||
services.tvheadend = { |
||||
enable = mkEnableOption "Tvheadend"; |
||||
httpPort = mkOption { |
||||
type = types.int; |
||||
default = 9981; |
||||
description = "Port to bind HTTP to."; |
||||
}; |
||||
|
||||
htspPort = mkOption { |
||||
type = types.int; |
||||
default = 9982; |
||||
description = "Port to bind HTSP to."; |
||||
}; |
||||
}; |
||||
}; |
||||
|
||||
config = mkIf cfg.enable { |
||||
users.extraUsers.tvheadend = { |
||||
description = "Tvheadend Service user"; |
||||
home = "/var/lib/tvheadend"; |
||||
createHome = true; |
||||
uid = config.ids.uids.tvheadend; |
||||
}; |
||||
|
||||
systemd.services.tvheadend = { |
||||
description = "Tvheadend TV streaming server"; |
||||
wantedBy = [ "multi-user.target" ]; |
||||
after = [ "network.target" ]; |
||||
|
||||
serviceConfig = { |
||||
Type = "forking"; |
||||
PIDFile = pidFile; |
||||
Restart = "always"; |
||||
RestartSec = 5; |
||||
User = "tvheadend"; |
||||
Group = "video"; |
||||
ExecStart = '' |
||||
${pkgs.tvheadend}/bin/tvheadend \ |
||||
--http_port ${toString cfg.httpPort} \ |
||||
--htsp_port ${toString cfg.htspPort} \ |
||||
-f \ |
||||
-C \ |
||||
-p ${pidFile} \ |
||||
-u tvheadend \ |
||||
-g video |
||||
''; |
||||
ExecStop = "${pkgs.coreutils}/bin/rm ${pidFile}"; |
||||
}; |
||||
}; |
||||
}; |
||||
} |
@ -0,0 +1,31 @@ |
||||
{avahi, dbus, fetchurl, git, gzip, libav, libiconv, openssl, pkgconfig, python, stdenv, which, zlib}: |
||||
|
||||
let version = "4.0.4"; |
||||
pkgName = "tvheadend"; in |
||||
|
||||
stdenv.mkDerivation rec { |
||||
name = "${pkgName}-${version}"; |
||||
|
||||
src = fetchurl { |
||||
url = "https://github.com/tvheadend/tvheadend/archive/v${version}.tar.gz"; |
||||
sha256 = "acc5c852bccb32d6a281f523e78a1cceb4d41987fe015aba3f66e1898b02c168"; |
||||
}; |
||||
|
||||
enableParallelBuilding = true; |
||||
|
||||
buildInputs = [ avahi dbus git gzip libav libiconv openssl pkgconfig python which zlib]; |
||||
|
||||
preConfigure = "patchShebangs ./configure"; |
||||
|
||||
meta = { |
||||
description = "TV steaming 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 = stdenv.lib.licenses.gpl3; |
||||
platforms = stdenv.lib.platforms.unix; |
||||
maintainers = [ stdenv.lib.maintainers.simonvandel ]; |
||||
}; |
||||
} |
Loading…
Reference in new issue