mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 14:54:29 +01:00
Merge pull request #146329 from mkg20001/rtsp
This commit is contained in:
commit
70798c6447
3 changed files with 84 additions and 3 deletions
|
@ -898,6 +898,7 @@
|
|||
./services/networking/unbound.nix
|
||||
./services/networking/unifi.nix
|
||||
./services/video/unifi-video.nix
|
||||
./services/video/rtsp-simple-server.nix
|
||||
./services/networking/v2ray.nix
|
||||
./services/networking/vsftpd.nix
|
||||
./services/networking/wasabibackend.nix
|
||||
|
|
80
nixos/modules/services/video/rtsp-simple-server.nix
Normal file
80
nixos/modules/services/video/rtsp-simple-server.nix
Normal file
|
@ -0,0 +1,80 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.rtsp-simple-server;
|
||||
package = pkgs.rtsp-simple-server;
|
||||
format = pkgs.formats.yaml {};
|
||||
in
|
||||
{
|
||||
options = {
|
||||
services.rtsp-simple-server = {
|
||||
enable = mkEnableOption "RTSP Simple Server";
|
||||
|
||||
settings = mkOption {
|
||||
description = ''
|
||||
Settings for rtsp-simple-server.
|
||||
Read more at <link xlink:href="https://github.com/aler9/rtsp-simple-server/blob/main/rtsp-simple-server.yml"/>
|
||||
'';
|
||||
type = format.type;
|
||||
|
||||
default = {
|
||||
logLevel = "info";
|
||||
logDestinations = [
|
||||
"stdout"
|
||||
];
|
||||
# we set this so when the user uses it, it just works (see LogsDirectory below). but it's not used by default.
|
||||
logFile = "/var/log/rtsp-simple-server/rtsp-simple-server.log";
|
||||
};
|
||||
|
||||
example = {
|
||||
paths = {
|
||||
cam = {
|
||||
runOnInit = "ffmpeg -f v4l2 -i /dev/video0 -f rtsp rtsp://localhost:$RTSP_PORT/$RTSP_PATH";
|
||||
runOnInitRestart = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
env = mkOption {
|
||||
type = with types; attrsOf anything;
|
||||
description = "Extra environment variables for RTSP Simple Server";
|
||||
default = {};
|
||||
example = {
|
||||
RTSP_CONFKEY = "mykey";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf (cfg.enable) {
|
||||
# NOTE: rtsp-simple-server watches this file and automatically reloads if it changes
|
||||
environment.etc."rtsp-simple-server.yaml".source = format.generate "rtsp-simple-server.yaml" cfg.settings;
|
||||
|
||||
systemd.services.rtsp-simple-server = {
|
||||
environment = cfg.env;
|
||||
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
path = with pkgs; [
|
||||
ffmpeg
|
||||
];
|
||||
|
||||
serviceConfig = {
|
||||
DynamicUser = true;
|
||||
User = "rtsp-simple-server";
|
||||
Group = "rtsp-simple-server";
|
||||
|
||||
LogsDirectory = "rtsp-simple-server";
|
||||
|
||||
# user likely may want to stream cameras, can't hurt to add video group
|
||||
SupplementaryGroups = "video";
|
||||
|
||||
ExecStart = "${package}/bin/rtsp-simple-server /etc/rtsp-simple-server.yaml";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -5,16 +5,16 @@
|
|||
|
||||
buildGoModule rec {
|
||||
pname = "rtsp-simple-server";
|
||||
version = "0.17.3";
|
||||
version = "0.17.8";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "aler9";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-9V6yblRnOAZBYuGChjeDyOTWjCCVhdFxljSndEr7GdY=";
|
||||
hash = "sha256-wjF7XTiUw5lPSmNiHvqUz4ZswpzLBoYF9S25dL8VPMU=";
|
||||
};
|
||||
|
||||
vendorSha256 = "sha256-lFyRMoI+frzAa7sL8wIzUgzJRrCQjt9Ri8T9pHIpoug=";
|
||||
vendorSha256 = "sha256-rntfePkwNGnyPjIzjLJhBYLTcndHP605Ah/xPcM6sRo=";
|
||||
|
||||
# Tests need docker
|
||||
doCheck = false;
|
||||
|
|
Loading…
Reference in a new issue