From dd3f755cf4e864bbf60613d5ca98d33ffbcbf9e6 Mon Sep 17 00:00:00 2001 From: Christian Kögler Date: Sat, 8 Dec 2018 10:18:26 +0100 Subject: vdr: initial at 2.4.0 and nixos module used same plugin mechanism as kodi does --- nixos/modules/module-list.nix | 1 + nixos/modules/services/hardware/vdr.nix | 67 +++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 nixos/modules/services/hardware/vdr.nix (limited to 'nixos') diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index e2b2666888cf..f879c9bf855e 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -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 diff --git a/nixos/modules/services/hardware/vdr.nix b/nixos/modules/services/hardware/vdr.nix new file mode 100644 index 000000000000..39a656ec7e48 --- /dev/null +++ b/nixos/modules/services/hardware/vdr.nix @@ -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 = {}; + }; +} -- cgit 1.4.1 From 45986ec5873c978725ed482dc9a35e215ebb0438 Mon Sep 17 00:00:00 2001 From: Jörg Thalheim Date: Sat, 22 Dec 2018 15:13:35 +0100 Subject: nixos/vdr: create video directory automatically --- nixos/modules/services/hardware/vdr.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'nixos') diff --git a/nixos/modules/services/hardware/vdr.nix b/nixos/modules/services/hardware/vdr.nix index 39a656ec7e48..b0ecb944b5e3 100644 --- a/nixos/modules/services/hardware/vdr.nix +++ b/nixos/modules/services/hardware/vdr.nix @@ -25,7 +25,7 @@ in { videoDir = mkOption { type = types.path; default = "/srv/vdr/video"; - description = "Recording directory (must exist)"; + description = "Recording directory"; }; extraArguments = mkOption { @@ -39,6 +39,10 @@ in { ###### implementation config = mkIf cfg.enable { + systemd.tmpfiles.rules = [ + "d ${cfg.videoDir} 0755 vdr vdr 0" + "Z ${cfg.videoDir} - vdr vdr -" + ]; systemd.services.vdr = { description = "VDR"; -- cgit 1.4.1