Added RTSP cam script
This commit is contained in:
parent
534f8199f3
commit
8c1db38398
3 changed files with 107 additions and 0 deletions
41
moduler/services/mediamtx/default.nix
Normal file
41
moduler/services/mediamtx/default.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
{
|
||||
options = {
|
||||
mediamtx = {
|
||||
enable = mkEnableOption "enables mediamtx";
|
||||
host = mkOption {
|
||||
type = types.str;
|
||||
default = "0.0.0.0";
|
||||
description = "The host address to bind RTSP on.";
|
||||
};
|
||||
rtspPort = mkOption {
|
||||
type = types.int;
|
||||
default = 8554;
|
||||
description = "RTSP port exposed by MediaMTX.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkMerge [
|
||||
(mkIf config.mediamtx.enable {
|
||||
virtualisation.podman.enable = true;
|
||||
|
||||
virtualisation.oci-containers = {
|
||||
backend = "podman";
|
||||
containers = {
|
||||
mediamtx = {
|
||||
image = "bluenviron/mediamtx:latest";
|
||||
ports = [ "${config.mediamtx.host}:${toString config.mediamtx.rtspPort}:8554" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ config.mediamtx.rtspPort ];
|
||||
})
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue