1 { config, lib, pkgs, ... }:
5 let cfg = config.services.tvheadend;
6 pidFile = "${config.users.users.tvheadend.home}/tvheadend.pid";
11 services.tvheadend = {
12 enable = mkEnableOption (lib.mdDoc "Tvheadend");
16 description = lib.mdDoc "Port to bind HTTP to.";
22 description = lib.mdDoc "Port to bind HTSP to.";
27 config = mkIf cfg.enable {
28 users.users.tvheadend = {
29 description = "Tvheadend Service user";
30 home = "/var/lib/tvheadend";
35 users.groups.tvheadend = {};
37 systemd.services.tvheadend = {
38 description = "Tvheadend TV streaming server";
39 wantedBy = [ "multi-user.target" ];
40 after = [ "network.target" ];
50 ${pkgs.tvheadend}/bin/tvheadend \
51 --http_port ${toString cfg.httpPort} \
52 --htsp_port ${toString cfg.htspPort} \
59 ExecStop = "${pkgs.coreutils}/bin/rm ${pidFile}";