summary refs log tree commit diff
path: root/nixos/modules/services/hardware/vdr.nix
diff options
context:
space:
mode:
authorChristian Kögler <ck3d@gmx.de>2018-12-08 10:18:26 +0100
committerJörg Thalheim <joerg@thalheim.io>2018-12-22 15:13:25 +0100
commitdd3f755cf4e864bbf60613d5ca98d33ffbcbf9e6 (patch)
treeaeee52b6106c93f1aa30717fe6be504d26f0e9c5 /nixos/modules/services/hardware/vdr.nix
parentca3f089a836ce970f8037485c2b65034de14269f (diff)
downloadnixpkgs-dd3f755cf4e864bbf60613d5ca98d33ffbcbf9e6.tar
nixpkgs-dd3f755cf4e864bbf60613d5ca98d33ffbcbf9e6.tar.gz
nixpkgs-dd3f755cf4e864bbf60613d5ca98d33ffbcbf9e6.tar.bz2
nixpkgs-dd3f755cf4e864bbf60613d5ca98d33ffbcbf9e6.tar.lz
nixpkgs-dd3f755cf4e864bbf60613d5ca98d33ffbcbf9e6.tar.xz
nixpkgs-dd3f755cf4e864bbf60613d5ca98d33ffbcbf9e6.tar.zst
nixpkgs-dd3f755cf4e864bbf60613d5ca98d33ffbcbf9e6.zip
vdr: initial at 2.4.0 and nixos module
used same plugin mechanism as kodi does
Diffstat (limited to 'nixos/modules/services/hardware/vdr.nix')
-rw-r--r--nixos/modules/services/hardware/vdr.nix67
1 files changed, 67 insertions, 0 deletions
diff --git a/nixos/modules/services/hardware/vdr.nix b/nixos/modules/services/hardware/vdr.nix
new file mode 100644
index 00000000000..39a656ec7e4
--- /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 = {};
+  };
+}