summary refs log tree commit diff
path: root/nixos/modules/services/networking/minidlna.nix
diff options
context:
space:
mode:
authorAntoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com>2019-03-07 11:29:25 +0100
committerBjørn Forsman <bjorn.forsman@gmail.com>2019-09-17 19:51:33 +0200
commit35fe50352fa4ea295fda43e429b4581533e48af4 (patch)
tree7f5484b5ee388bfb4905088ce0ae7c18d6623b13 /nixos/modules/services/networking/minidlna.nix
parent446dd2543d8be0d53c30166133dd964a5340e214 (diff)
downloadnixpkgs-35fe50352fa4ea295fda43e429b4581533e48af4.tar
nixpkgs-35fe50352fa4ea295fda43e429b4581533e48af4.tar.gz
nixpkgs-35fe50352fa4ea295fda43e429b4581533e48af4.tar.bz2
nixpkgs-35fe50352fa4ea295fda43e429b4581533e48af4.tar.lz
nixpkgs-35fe50352fa4ea295fda43e429b4581533e48af4.tar.xz
nixpkgs-35fe50352fa4ea295fda43e429b4581533e48af4.tar.zst
nixpkgs-35fe50352fa4ea295fda43e429b4581533e48af4.zip
nixos/minidlna: Allow more configuration options
This commits allows the user to configure:
- more minidlna options
- the ones not yet disclosed in nix (extending the existing minimal subset)
Diffstat (limited to 'nixos/modules/services/networking/minidlna.nix')
-rw-r--r--nixos/modules/services/networking/minidlna.nix67
1 files changed, 65 insertions, 2 deletions
diff --git a/nixos/modules/services/networking/minidlna.nix b/nixos/modules/services/networking/minidlna.nix
index 0947471adbc..3ddea3c9757 100644
--- a/nixos/modules/services/networking/minidlna.nix
+++ b/nixos/modules/services/networking/minidlna.nix
@@ -36,6 +36,37 @@ in
         '';
     };
 
+    services.minidlna.friendlyName = mkOption {
+      type = types.str;
+      default = "${config.networking.hostName} MiniDLNA";
+      defaultText = "$HOSTNAME MiniDLNA";
+      example = "rpi3";
+      description =
+        ''
+          Name that the DLNA server presents to clients.
+        '';
+    };
+
+    services.minidlna.rootContainer = mkOption {
+      type = types.str;
+      default = ".";
+      example = "B";
+      description =
+        ''
+          Use a different container as the root of the directory tree presented
+          to clients. The possible values are:
+          - "." - standard container
+          - "B" - "Browse Directory"
+          - "M" - "Music"
+          - "P" - "Pictures"
+          - "V" - "Video"
+          - Or, you can specify the ObjectID of your desired root container
+            (eg. 1$F for Music/Playlists)
+          If you specify "B" and the client device is audio-only then
+          "Music/Folders" will be used as root.
+         '';
+    };
+
     services.minidlna.loglevel = mkOption {
       type = types.str;
       default = "warn";
@@ -66,7 +97,37 @@ in
 
     services.minidlna.config = mkOption {
       type = types.lines;
-      description = "The contents of MiniDLNA's configuration file.";
+      description =
+      ''
+        The contents of MiniDLNA's configuration file.
+        When the service is activated, a basic template is generated
+        from the current options opened here.
+      '';
+    };
+
+    services.minidlna.extraConfig = mkOption {
+      type = types.lines;
+      default = "";
+      example = ''
+        # Not exhaustive example
+        # Support for streaming .jpg and .mp3 files to a TiVo supporting HMO.
+        enable_tivo=no
+        # SSDP notify interval, in seconds.
+        notify_interval=10
+        # maximum number of simultaneous connections
+        # note: many clients open several simultaneous connections while
+        # streaming
+        max_connections=50
+        # set this to yes to allow symlinks that point outside user-defined
+        # media_dirs.
+        wide_links=yes
+      '';
+      description =
+      ''
+        Extra minidlna options not yet opened for configuration here
+        (strict_dlna, model_number, model_name, etc...).  This is appended
+        to the current service already provided.
+      '';
     };
   };
 
@@ -75,13 +136,15 @@ in
     services.minidlna.config =
       ''
         port=${toString port}
-        friendly_name=${config.networking.hostName} MiniDLNA
+        friendly_name=${cfg.friendlyName}
         db_dir=/var/cache/minidlna
         log_level=${cfg.loglevel}
         inotify=yes
+        root_container=${cfg.rootContainer}
         ${concatMapStrings (dir: ''
           media_dir=${dir}
         '') cfg.mediaDirs}
+        ${cfg.extraConfig}
       '';
 
     users.users.minidlna = {