summary refs log tree commit diff
path: root/nixos/modules/services/networking/minidlna.nix
diff options
context:
space:
mode:
authorobadz <obadz-git@obadz.com>2018-04-08 00:18:56 +0100
committerobadz <obadz-git@obadz.com>2018-04-09 00:16:06 +0100
commitf3657a05d82082e4bf1610c69216f71bbe731253 (patch)
tree721fcd395152d04acb98b9b11ab56db978ee80c4 /nixos/modules/services/networking/minidlna.nix
parentc1e1690f629d2fc5c99fbbb1fd81856b02d3cc7d (diff)
downloadnixpkgs-f3657a05d82082e4bf1610c69216f71bbe731253.tar
nixpkgs-f3657a05d82082e4bf1610c69216f71bbe731253.tar.gz
nixpkgs-f3657a05d82082e4bf1610c69216f71bbe731253.tar.bz2
nixpkgs-f3657a05d82082e4bf1610c69216f71bbe731253.tar.lz
nixpkgs-f3657a05d82082e4bf1610c69216f71bbe731253.tar.xz
nixpkgs-f3657a05d82082e4bf1610c69216f71bbe731253.tar.zst
nixpkgs-f3657a05d82082e4bf1610c69216f71bbe731253.zip
minidlna nixos module: add loglevel config
Diffstat (limited to 'nixos/modules/services/networking/minidlna.nix')
-rw-r--r--nixos/modules/services/networking/minidlna.nix43
1 files changed, 29 insertions, 14 deletions
diff --git a/nixos/modules/services/networking/minidlna.nix b/nixos/modules/services/networking/minidlna.nix
index 61d063dbfe0..6401631bf62 100644
--- a/nixos/modules/services/networking/minidlna.nix
+++ b/nixos/modules/services/networking/minidlna.nix
@@ -1,23 +1,16 @@
 # Module for MiniDLNA, a simple DLNA server.
-
 { config, lib, pkgs, ... }:
 
 with lib;
 
 let
-
   cfg = config.services.minidlna;
-
   port = 8200;
-
 in
 
 {
-
   ###### interface
-
   options = {
-
     services.minidlna.enable = mkOption {
       type = types.bool;
       default = false;
@@ -43,24 +36,48 @@ in
         '';
     };
 
+    services.minidlna.loglevel = mkOption {
+      type = types.str;
+      default = "warn";
+      example = "general,artwork,database,inotify,scanner,metadata,http,ssdp,tivo=warn";
+      description =
+        ''
+          Defines the type of messages that should be logged, and down to
+          which level of importance they should be considered.
+
+          The possible types are “artwork”, “database”, “general”, “http”,
+          “inotify”, “metadata”, “scanner”, “ssdp” and “tivo”.
+
+          The levels are “off”, “fatal”, “error”, “warn”, “info” and
+          “debug”, listed here in order of decreasing importance.  “off”
+          turns off logging messages entirely, “fatal” logs the most
+          critical messages only, and so on down to “debug” that logs every
+          single messages.
+
+          The types are comma-separated, followed by an equal sign (‘=’),
+          followed by a level that applies to the preceding types. This can
+          be repeated, separating each of these constructs with a comma.
+
+          Defaults to “general,artwork,database,inotify,scanner,metadata,
+          http,ssdp,tivo=warn” which logs every type of message at the
+          “warn” level.
+        '';
+    };
+
     services.minidlna.config = mkOption {
       type = types.lines;
       description = "The contents of MiniDLNA's configuration file.";
     };
-
   };
 
-
   ###### implementation
-
   config = mkIf cfg.enable {
-
     services.minidlna.config =
       ''
         port=${toString port}
         friendly_name=${config.networking.hostName} MiniDLNA
         db_dir=/var/cache/minidlna
-        log_level=warn
+        log_level=${cfg.loglevel}
         inotify=yes
         ${concatMapStrings (dir: ''
           media_dir=${dir}
@@ -98,7 +115,5 @@ in
               " -f ${pkgs.writeText "minidlna.conf" cfg.config}";
           };
       };
-
   };
-
 }