-
Notifications
You must be signed in to change notification settings - Fork 0
/
mediamtx.nix
58 lines (51 loc) · 1.22 KB
/
mediamtx.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{ config, pkgs, lib, ... }:
let
addresses = config.gradient.const.wireguard.addresses;
settings = pkgs.writeText "mediamtx.yml" (builtins.toJSON {
api = true;
apiAddress = ":9997";
authMethod = "internal";
authInternalUsers = [
{
user = "any";
pass = "";
ips = [];
permissions = [
{ action = "publish"; path = ""; }
{ action = "read"; path = ""; }
{ action = "playback"; path = ""; }
];
}
{
user = "any";
pass = "";
ips = with addresses.gradientnet; [
"127.0.0.1"
"::1"
bernkastel
];
permissions = [
{ action = "api"; }
{ action = "metrics"; }
{ action = "pprof"; }
];
}
];
paths = {
constellation = {
source = "publisher";
};
all_others = {};
};
});
in
{
virtualisation.oci-containers.containers.mediamtx = {
image = "bluenviron/mediamtx:1.6.0";
volumes = [ "${settings}:/mediamtx.yml" ];
environment = { TZ = config.time.timeZone; };
extraOptions = [ "--network=host" ];
};
# TODO: Remove below.
networking.firewall.trustedInterfaces = [ "gradientnet" ];
}