mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-13 09:13:17 +00:00
ef176dcf7e
conversions were done using https://github.com/pennae/nix-doc-munge using (probably) rev f34e145 running nix-doc-munge nixos/**/*.nix nix-doc-munge --import nixos/**/*.nix the tool ensures that only changes that could affect the generated manual *but don't* are committed, other changes require manual review and are discarded.
64 lines
1.7 KiB
Nix
64 lines
1.7 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let cfg = config.services.tvheadend;
|
|
pidFile = "${config.users.users.tvheadend.home}/tvheadend.pid";
|
|
in
|
|
|
|
{
|
|
options = {
|
|
services.tvheadend = {
|
|
enable = mkEnableOption (lib.mdDoc "Tvheadend");
|
|
httpPort = mkOption {
|
|
type = types.int;
|
|
default = 9981;
|
|
description = lib.mdDoc "Port to bind HTTP to.";
|
|
};
|
|
|
|
htspPort = mkOption {
|
|
type = types.int;
|
|
default = 9982;
|
|
description = lib.mdDoc "Port to bind HTSP to.";
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
users.users.tvheadend = {
|
|
description = "Tvheadend Service user";
|
|
home = "/var/lib/tvheadend";
|
|
createHome = true;
|
|
isSystemUser = true;
|
|
group = "tvheadend";
|
|
};
|
|
users.groups.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}";
|
|
};
|
|
};
|
|
};
|
|
}
|