git.iko.soy/typeable/nixpkgs
on master help sign in
minidlna nixos module: add loglevel config
commitf3657a05d82082e4bf1610c69216f71bbe731253 authorobadz <obadz-git@obadz.com> dateSun 8 Apr 2018, 00:18 (9 years ago) parentc1e1690
1 file changed+29−14
nixos/modules/services/networking/minidlna.nix+29−14
nixos/modules/services/networking/minidlna.nix+29−14
@@ -1,23 +1,16 @@
11# Module for MiniDLNA, a simple DLNA server.
2−
32{ config, lib, pkgs, ... }:
43
54with lib;
65
76let
8−
97 cfg = config.services.minidlna;
10−
118 port = 8200;
12−
139in
1410
1511{
16−
1712 ###### interface
18−
1913 options = {
20−
2114 services.minidlna.enable = mkOption {
2215 type = types.bool;
2316 default = false;
@@ -43,24 +36,48 @@ in
4336 '';
4437 };
4538
39+ services.minidlna.loglevel = mkOption {
40+ type = types.str;
41+ default = "warn";
42+ example = "general,artwork,database,inotify,scanner,metadata,http,ssdp,tivo=warn";
43+ description =
44+ ''
45+ Defines the type of messages that should be logged, and down to
46+ which level of importance they should be considered.
47+
48+ The possible types are “artwork”, “database”, “general”, “http”,
49+ “inotify”, “metadata”, “scanner”, “ssdp” and “tivo”.
50+
51+ The levels are “off”, “fatal”, “error”, “warn”, “info” and
52+ “debug”, listed here in order of decreasing importance. “off”
53+ turns off logging messages entirely, “fatal” logs the most
54+ critical messages only, and so on down to “debug” that logs every
55+ single messages.
56+
57+ The types are comma-separated, followed by an equal sign (‘=’),
58+ followed by a level that applies to the preceding types. This can
59+ be repeated, separating each of these constructs with a comma.
60+
61+ Defaults to “general,artwork,database,inotify,scanner,metadata,
62+ http,ssdp,tivo=warn” which logs every type of message at the
63+ “warn” level.
64+ '';
65+ };
66+
4667 services.minidlna.config = mkOption {
4768 type = types.lines;
4869 description = "The contents of MiniDLNA's configuration file.";
4970 };
50−
5171 };
5272
53−
5473 ###### implementation
55−
5674 config = mkIf cfg.enable {
57−
5875 services.minidlna.config =
5976 ''
6077 port=${toString port}
6178 friendly_name=${config.networking.hostName} MiniDLNA
6279 db_dir=/var/cache/minidlna
63− log_level=warn
80+ log_level=${cfg.loglevel}
6481 inotify=yes
6582 ${concatMapStrings (dir: ''
6683 media_dir=${dir}
@@ -98,7 +115,5 @@ in
98115 " -f ${pkgs.writeText "minidlna.conf" cfg.config}";
99116 };
100117 };
101−
102118 };
103−
104119}