Unverified Commit 1162c1ed authored by Emily's avatar Emily Committed by GitHub
Browse files

{tvheadend,antennas}: drop (#336395)

parents 8a4ba48a a565cfea
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -344,6 +344,15 @@
  were not used by any other package. External users are encouraged to
  migrate to OpenCV 4.

- The `tvheadend` package and the `services.tvheadend` module have been
  removed as nobody was willing to maintain them and they were stuck on
  an unmaintained version that required FFmpeg 4; please see [pull
  request #332259](https://github.com/NixOS/nixpkgs/pull/332259) if you
  are interested in maintaining a newer version.

- The `antennas` package and the `services.antennas` module have been
  removed as they only work with `tvheadend` (see above).

## Other Notable Changes {#sec-release-24.11-notable-changes}

<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
+0 −2
Original line number Diff line number Diff line
@@ -969,7 +969,6 @@
  ./services/networking/adguardhome.nix
  ./services/networking/alice-lg.nix
  ./services/networking/amuled.nix
  ./services/networking/antennas.nix
  ./services/networking/aria2.nix
  ./services/networking/asterisk.nix
  ./services/networking/atftpd.nix
@@ -1240,7 +1239,6 @@
  ./services/networking/tox-node.nix
  ./services/networking/toxvpn.nix
  ./services/networking/trickster.nix
  ./services/networking/tvheadend.nix
  ./services/networking/twingate.nix
  ./services/networking/ucarp.nix
  ./services/networking/unbound.nix
+2 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ in
      The hidepid module was removed, since the underlying machinery
      is broken when using cgroups-v2.
    '')
    (mkRemovedOptionModule [ "services" "antennas" ] "The antennas package and the corresponding module have been removed as they only work with tvheadend, which nobody was willing to maintain and was stuck on an unmaintained version that required FFmpeg 4; please see https://github.com/NixOS/nixpkgs/pull/332259 if you are interested in maintaining a newer version.")
    (mkRemovedOptionModule [ "services" "baget" "enable" ] "The baget module was removed due to the upstream package being unmaintained.")
    (mkRemovedOptionModule [ "services" "beegfs" ] "The BeeGFS module has been removed")
    (mkRemovedOptionModule [ "services" "beegfsEnable" ] "The BeeGFS module has been removed")
@@ -94,6 +95,7 @@ in
      the program being unmaintained. The options `programs.msmtp.*` can be
      used instead.
    '')
    (mkRemovedOptionModule [ "services" "tvheadend" ] "The tvheadend package and the corresponding module have been removed as nobody was willing to maintain them and they were stuck on an unmaintained version that required FFmpeg 4; please see https://github.com/NixOS/nixpkgs/pull/332259 if you are interested in maintaining a newer version.")
    (mkRemovedOptionModule [ "services" "venus" ] "The corresponding package was removed from nixpkgs.")
    (mkRemovedOptionModule [ "services" "wakeonlan"] "This module was removed in favor of enabling it with networking.interfaces.<name>.wakeOnLan")
    (mkRemovedOptionModule [ "services" "winstone" ] "The corresponding package was removed from nixpkgs.")
+0 −77
Original line number Diff line number Diff line
{ config, lib, pkgs, ... }:

with lib;

let cfg = config.services.antennas;
in

{
  options = {
    services.antennas = {
      enable = mkEnableOption "Antennas";

      tvheadendUrl = mkOption {
        type        = types.str;
        default     = "http://localhost:9981";
        description = "URL of Tvheadend.";
      };

      antennasUrl = mkOption {
        type        = types.str;
        default     = "http://127.0.0.1:5004";
        description = "URL of Antennas.";
      };

      tunerCount = mkOption {
        type        = types.int;
        default     = 6;
        description = "Numbers of tuners in tvheadend.";
      };

      deviceUUID = mkOption {
        type        = types.str;
        default     = "2f70c0d7-90a3-4429-8275-cbeeee9cd605";
        description = "Device tuner UUID. Change this if you are running multiple instances.";
      };
    };
  };

  config = mkIf cfg.enable {
    systemd.services.antennas = {
      description = "Antennas HDHomeRun emulator for Tvheadend.";
      wantedBy    = [ "multi-user.target" ];

      # Config
      environment = {
        TVHEADEND_URL = cfg.tvheadendUrl;
        ANTENNAS_URL = cfg.antennasUrl;
        TUNER_COUNT = toString cfg.tunerCount;
        DEVICE_UUID = cfg.deviceUUID;
      };

      serviceConfig = {
        ExecStart = "${pkgs.antennas}/bin/antennas";

        # Hardening
        CapabilityBoundingSet = [ "" ];
        DynamicUser = true;
        LockPersonality = true;
        ProcSubset = "pid";
        PrivateDevices = true;
        PrivateUsers = true;
        PrivateTmp = true;
        ProtectClock = true;
        ProtectControlGroups = true;
        ProtectHome = true;
        ProtectHostname = true;
        ProtectKernelLogs = true;
        ProtectKernelModules = true;
        ProtectKernelTunables = true;
        ProtectProc = "invisible";
        ProtectSystem = "strict";
        RestrictNamespaces = true;
        RestrictRealtime = true;
      };
    };
  };
}
+0 −63
Original line number Diff line number Diff line
{ config, lib, pkgs, ... }:

with lib;

let cfg     = config.services.tvheadend;
    pidFile = "${config.users.users.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.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}";
      };
    };
  };
}
Loading