vdr: initial at 2.4.0 and nixos module

used same plugin mechanism as kodi does
This commit is contained in:
Christian Kögler
2018-12-08 10:18:26 +01:00
committed by Jörg Thalheim
parent ca3f089a83
commit dd3f755cf4
6 changed files with 489 additions and 0 deletions

View File

@@ -299,6 +299,7 @@
./services/hardware/usbmuxd.nix
./services/hardware/thermald.nix
./services/hardware/undervolt.nix
./services/hardware/vdr.nix
./services/logging/SystemdJournal2Gelf.nix
./services/logging/awstats.nix
./services/logging/fluentd.nix

View File

@@ -0,0 +1,67 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.vdr;
libDir = "/var/lib/vdr";
in {
###### interface
options = {
services.vdr = {
enable = mkEnableOption "enable VDR. Please put config into ${libDir}.";
package = mkOption {
type = types.package;
default = pkgs.vdr;
defaultText = "pkgs.vdr";
example = literalExample "pkgs.wrapVdr.override { plugins = with pkgs.vdrPlugins; [ hello ]; }";
description = "Package to use.";
};
videoDir = mkOption {
type = types.path;
default = "/srv/vdr/video";
description = "Recording directory (must exist)";
};
extraArguments = mkOption {
type = types.listOf types.str;
default = [];
description = "Additional command line arguments to pass to VDR.";
};
};
};
###### implementation
config = mkIf cfg.enable {
systemd.services.vdr = {
description = "VDR";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = ''
${cfg.package}/bin/vdr \
--video="${cfg.videoDir}" \
--config="${libDir}" \
${escapeShellArgs cfg.extraArguments}
'';
User = "vdr";
CacheDirectory = "vdr";
StateDirectory = "vdr";
Restart = "on-failure";
};
};
users.users.vdr = {
group = "vdr";
home = libDir;
};
users.groups.vdr = {};
};
}