2019-11-09 22:28:09 +03:00
|
|
|
import ./make-test-python.nix ({ pkgs, ... }: {
|
2019-03-07 13:29:25 +03:00
|
|
|
name = "minidlna";
|
|
|
|
|
|
|
|
nodes = {
|
|
|
|
server =
|
|
|
|
{ ... }:
|
|
|
|
{
|
|
|
|
imports = [ ../modules/profiles/minimal.nix ];
|
|
|
|
networking.firewall.allowedTCPPorts = [ 8200 ];
|
|
|
|
services.minidlna = {
|
|
|
|
enable = true;
|
|
|
|
loglevel = "error";
|
|
|
|
mediaDirs = [
|
|
|
|
"PV,/tmp/stuff"
|
|
|
|
];
|
|
|
|
friendlyName = "rpi3";
|
|
|
|
rootContainer = "B";
|
|
|
|
extraConfig =
|
|
|
|
''
|
|
|
|
album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg
|
|
|
|
album_art_names=AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg
|
|
|
|
album_art_names=Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg
|
|
|
|
notify_interval=60
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
client = { ... }: { };
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript =
|
|
|
|
''
|
2019-11-09 22:28:09 +03:00
|
|
|
start_all()
|
|
|
|
server.succeed("mkdir -p /tmp/stuff && chown minidlna: /tmp/stuff")
|
|
|
|
server.wait_for_unit("minidlna")
|
2022-06-11 15:22:53 +03:00
|
|
|
server.wait_for_open_port(8200)
|
2022-03-06 16:08:19 +03:00
|
|
|
# requests must be made *by IP* to avoid triggering minidlna's
|
|
|
|
# DNS-rebinding protection
|
|
|
|
server.succeed("curl --fail http://$(getent ahostsv4 localhost | head -n1 | cut -f 1 -d ' '):8200/")
|
|
|
|
client.succeed("curl --fail http://$(getent ahostsv4 server | head -n1 | cut -f 1 -d ' '):8200/")
|
2019-03-07 13:29:25 +03:00
|
|
|
'';
|
|
|
|
})
|