···5566let
77 cfg = config.services.minidlna;
88- port = 8200;
88+ settingsFormat = pkgs.formats.keyValue { listsAsDuplicateKeys = true; };
99+ settingsFile = settingsFormat.generate "minidlna.conf" cfg.settings;
910in
10111112{
1213 ###### interface
1313- options = {
1414- services.minidlna.enable = mkOption {
1515- type = types.bool;
1616- default = false;
1717- description =
1818- ''
1919- Whether to enable MiniDLNA, a simple DLNA server. It serves
2020- media files such as video and music to DLNA client devices
2121- such as televisions and media players.
2222- '';
2323- };
2424-2525- services.minidlna.mediaDirs = mkOption {
2626- type = types.listOf types.str;
2727- default = [];
2828- example = [ "/data/media" "V,/home/alice/video" ];
2929- description =
3030- ''
3131- Directories to be scanned for media files. The prefixes
3232- <literal>A,</literal>, <literal>V,</literal> and
3333- <literal>P,</literal> restrict a directory to audio, video
3434- or image files. The directories must be accessible to the
3535- <literal>minidlna</literal> user account.
3636- '';
3737- };
3838-3939- services.minidlna.friendlyName = mkOption {
4040- type = types.str;
4141- default = "${config.networking.hostName} MiniDLNA";
4242- defaultText = literalExpression ''"''${config.networking.hostName} MiniDLNA"'';
4343- example = "rpi3";
4444- description =
4545- ''
4646- Name that the DLNA server presents to clients.
4747- '';
4848- };
4949-5050- services.minidlna.rootContainer = mkOption {
5151- type = types.str;
5252- default = ".";
5353- example = "B";
5454- description =
5555- ''
5656- Use a different container as the root of the directory tree presented
5757- to clients. The possible values are:
5858- - "." - standard container
5959- - "B" - "Browse Directory"
6060- - "M" - "Music"
6161- - "P" - "Pictures"
6262- - "V" - "Video"
6363- - Or, you can specify the ObjectID of your desired root container
6464- (eg. 1$F for Music/Playlists)
6565- If you specify "B" and the client device is audio-only then
6666- "Music/Folders" will be used as root.
6767- '';
6868- };
6969-7070- services.minidlna.loglevel = mkOption {
7171- type = types.str;
7272- default = "warn";
7373- example = "general,artwork,database,inotify,scanner,metadata,http,ssdp,tivo=warn";
7474- description =
7575- ''
7676- Defines the type of messages that should be logged, and down to
7777- which level of importance they should be considered.
7878-7979- The possible types are “artwork”, “database”, “general”, “http”,
8080- “inotify”, “metadata”, “scanner”, “ssdp” and “tivo”.
1414+ options.services.minidlna.enable = mkOption {
1515+ type = types.bool;
1616+ default = false;
1717+ description = ''
1818+ Whether to enable MiniDLNA, a simple DLNA server.
1919+ It serves media files such as video and music to DLNA client devices
2020+ such as televisions and media players. If you use the firewall consider
2121+ adding the following: <literal>services.minidlna.openFirewall = true;</literal>
2222+ '';
2323+ };
81248282- The levels are “off”, “fatal”, “error”, “warn”, “info” and
8383- “debug”, listed here in order of decreasing importance. “off”
8484- turns off logging messages entirely, “fatal” logs the most
8585- critical messages only, and so on down to “debug” that logs every
8686- single messages.
2525+ options.services.minidlna.openFirewall = mkOption {
2626+ type = types.bool;
2727+ default = false;
2828+ description = ''
2929+ Whether to open both HTTP (TCP) and SSDP (UDP) ports in the firewall.
3030+ '';
3131+ };
87328888- The types are comma-separated, followed by an equal sign (‘=’),
8989- followed by a level that applies to the preceding types. This can
9090- be repeated, separating each of these constructs with a comma.
3333+ options.services.minidlna.settings = mkOption {
3434+ default = {};
3535+ description = ''
3636+ The contents of MiniDLNA's configuration file.
3737+ When the service is activated, a basic template is generated
3838+ from the current options opened here.
3939+ '';
4040+ type = types.submodule {
4141+ freeformType = settingsFormat.type;
91429292- Defaults to “general,artwork,database,inotify,scanner,metadata,
9393- http,ssdp,tivo=warn” which logs every type of message at the
9494- “warn” level.
4343+ options.media_dir = mkOption {
4444+ type = types.listOf types.str;
4545+ default = [];
4646+ example = [ "/data/media" "V,/home/alice/video" ];
4747+ description = ''
4848+ Directories to be scanned for media files.
4949+ The prefixes <literal>A,</literal>,<literal>V,</literal> and
5050+ <literal>P,</literal> restrict a directory to audio, video
5151+ or image files. The directories must be accessible to the
5252+ <literal>minidlna</literal> user account.
9553 '';
9696- };
9797-9898- services.minidlna.announceInterval = mkOption {
9999- type = types.int;
100100- default = 895;
101101- description =
102102- ''
5454+ };
5555+ options.notify_interval = mkOption {
5656+ type = types.int;
5757+ default = 90000;
5858+ description = ''
10359 The interval between announces (in seconds).
6060+ Instead of waiting on announces, one can open port UDP 1900 or
6161+ set <literal>openFirewall</literal> option to use SSDP discovery.
6262+ Furthermore announce interval has now been set as 90000 in order
6363+ to prevent disconnects with certain clients and to rely solely
6464+ on the SSDP method.
10465105105- By default miniDLNA will announce its presence on the network
106106- approximately every 15 minutes.
6666+ Lower values (e.g. 60 seconds) should be used if one does not
6767+ want to utilize SSDP. By default miniDLNA will announce its
6868+ presence on the network approximately every 15 minutes. Many
6969+ people prefer shorter announce intervals on their home networks,
7070+ especially when DLNA clients are started on demand.
10771108108- Many people prefer shorter announce intervals (e.g. 60 seconds)
109109- on their home networks, especially when DLNA clients are
110110- started on demand.
7272+ Some relevant information can be found here:
7373+ https://sourceforge.net/p/minidlna/discussion/879957/thread/1389d197/
11174 '';
112112- };
113113-114114- services.minidlna.config = mkOption {
115115- type = types.lines;
116116- description =
117117- ''
118118- The contents of MiniDLNA's configuration file.
119119- When the service is activated, a basic template is generated
120120- from the current options opened here.
121121- '';
122122- };
123123-124124- services.minidlna.extraConfig = mkOption {
125125- type = types.lines;
126126- default = "";
127127- example = ''
128128- # Not exhaustive example
129129- # Support for streaming .jpg and .mp3 files to a TiVo supporting HMO.
130130- enable_tivo=no
131131- # SSDP notify interval, in seconds.
132132- notify_interval=10
133133- # maximum number of simultaneous connections
134134- # note: many clients open several simultaneous connections while
135135- # streaming
136136- max_connections=50
137137- # set this to yes to allow symlinks that point outside user-defined
138138- # media_dirs.
139139- wide_links=yes
140140- '';
141141- description =
142142- ''
143143- Extra minidlna options not yet opened for configuration here
144144- (strict_dlna, model_number, model_name, etc...). This is appended
145145- to the current service already provided.
146146- '';
7575+ };
7676+ options.port = mkOption {
7777+ type = types.port;
7878+ default = 8200;
7979+ description = "Port number for HTTP traffic (descriptions, SOAP, media transfer).";
8080+ };
8181+ options.db_dir = mkOption {
8282+ type = types.path;
8383+ default = "/var/cache/minidlna";
8484+ example = "/tmp/minidlna";
8585+ description = "Specify the directory where you want MiniDLNA to store its database and album art cache.";
8686+ };
8787+ options.friendly_name = mkOption {
8888+ type = types.str;
8989+ default = "${config.networking.hostName} MiniDLNA";
9090+ defaultText = literalExpression "config.networking.hostName";
9191+ example = "rpi3";
9292+ description = "Name that the DLNA server presents to clients.";
9393+ };
9494+ options.root_container = mkOption {
9595+ type = types.str;
9696+ default = ".";
9797+ example = "B";
9898+ description = "Use a different container as the root of the directory tree presented to clients.";
9999+ };
100100+ options.log_level = mkOption {
101101+ type = types.str;
102102+ default = "warn";
103103+ example = "general,artwork,database,inotify,scanner,metadata,http,ssdp,tivo=warn";
104104+ description = "Defines the type of messages that should be logged and down to which level of importance.";
105105+ };
106106+ options.inotify = mkOption {
107107+ type = types.enum [ "yes" "no" ];
108108+ default = "no";
109109+ description = "Whether to enable inotify monitoring to automatically discover new files.";
110110+ };
111111+ options.enable_tivo = mkOption {
112112+ type = types.enum [ "yes" "no" ];
113113+ default = "no";
114114+ description = "Support for streaming .jpg and .mp3 files to a TiVo supporting HMO.";
115115+ };
116116+ options.wide_links = mkOption {
117117+ type = types.enum [ "yes" "no" ];
118118+ default = "no";
119119+ description = "Set this to yes to allow symlinks that point outside user-defined media_dirs.";
120120+ };
147121 };
148122 };
149123124124+ imports = [
125125+ (mkRemovedOptionModule [ "services" "minidlna" "config" ] "")
126126+ (mkRemovedOptionModule [ "services" "minidlna" "extraConfig" ] "")
127127+ (mkRenamedOptionModule [ "services" "minidlna" "loglevel"] [ "services" "minidlna" "settings" "log_level" ])
128128+ (mkRenamedOptionModule [ "services" "minidlna" "rootContainer"] [ "services" "minidlna" "settings" "root_container" ])
129129+ (mkRenamedOptionModule [ "services" "minidlna" "mediaDirs"] [ "services" "minidlna" "settings" "media_dir" ])
130130+ (mkRenamedOptionModule [ "services" "minidlna" "friendlyName"] [ "services" "minidlna" "settings" "friendly_name" ])
131131+ (mkRenamedOptionModule [ "services" "minidlna" "announceInterval"] [ "services" "minidlna" "settings" "notify_interval" ])
132132+ ];
133133+150134 ###### implementation
151135 config = mkIf cfg.enable {
152152- services.minidlna.config =
153153- ''
154154- port=${toString port}
155155- friendly_name=${cfg.friendlyName}
156156- db_dir=/var/cache/minidlna
157157- log_level=${cfg.loglevel}
158158- inotify=yes
159159- root_container=${cfg.rootContainer}
160160- ${concatMapStrings (dir: ''
161161- media_dir=${dir}
162162- '') cfg.mediaDirs}
163163- notify_interval=${toString cfg.announceInterval}
164164- ${cfg.extraConfig}
165165- '';
136136+ networking.firewall.allowedTCPPorts = mkIf cfg.openFirewall [ cfg.settings.port ];
137137+ networking.firewall.allowedUDPPorts = mkIf cfg.openFirewall [ 1900 ];
166138167139 users.users.minidlna = {
168140 description = "MiniDLNA daemon user";
···186158 PIDFile = "/run/minidlna/pid";
187159 ExecStart =
188160 "${pkgs.minidlna}/sbin/minidlnad -S -P /run/minidlna/pid" +
189189- " -f ${pkgs.writeText "minidlna.conf" cfg.config}";
161161+ " -f ${settingsFile}";
190162 };
191163 };
192164 };
···15151616 proxyVendor = true;
17171818- vendorSha256 = "sha256-1vlgnY4kZJfoAtbv+r8onxL03Ak32zKLJgtrBYZX09g=";
1818+ vendorSha256 = "sha256-n9XNqXIoqn+f0xKCenJWXUYXtQhtbNBar68onWH/WV4=";
19192020 meta = with lib; {
2121 description = "RSS/Atom reader with the focus on speed, usability and a bit of unix philosophy";
···1111 sha256 = "125mw70jidbp436arhv77201jdp6mpgqa2dzmrpmk55f9bf29sg6";
1212 };
13131414- vendorSha256 = "17m0ssfw9n3g2lkv63qajz3adrk5yp0c9hx66x7dl79snwqd49yg";
1414+ vendorSha256 = "sha256-llseW3k8ygTXwkSpnRfQEnX3OVj2zdL8JDpIoRcC9kE=";
15151616 doCheck = false;
17171818 ldflags = [
1919+ "-s"
2020+ "-w"
1921 "-X main.tag=v${version}"
2022 ];
21232224 meta = with lib; {
2323- description = ''
2424- This project aims at creating a universal dark theme for Firefox while
2525- adhering to the modern design principles set by Mozilla.
2626- '';
2525+ description = "Universal dark theme for Firefox while adhering to the modern design principles set by Mozilla";
2726 homepage = "https://overdodactyl.github.io/ShadowFox/";
2827 license = licenses.mit;
2928 maintainers = with maintainers; [ infinisil ];
+6-2
pkgs/tools/networking/wakeonlan/default.nix
···1414 outputs = [ "out" ];
15151616 nativeBuildInputs = [ installShellFiles ];
1717- # checkInputs = [ perl534Packages.TestPerlCritic perl534Packages.TestPod perl534Packages.TestPodCoverage ];
1818- doCheck = false; # Missing package for https://github.com/genio/test-spelling to run tests
1717+1818+ checkInputs = [ perlPackages.TestPerlCritic perlPackages.TestPod perlPackages.TestPodCoverage ];
1919+ # Linting and formatting checks are of no interest for us.
2020+ preCheck = ''
2121+ rm -f t/93_pod_spell.t
2222+ '';
19232024 installPhase = ''
2125 install -Dt $out/bin wakeonlan