pulsebert: double-proxy the espCam
This commit is contained in:
parent
c06710cf18
commit
71495bc257
|
@ -6,6 +6,7 @@
|
|||
|
||||
let
|
||||
octoprintPort = 8080;
|
||||
espCam = "http://172.20.78.164:81";
|
||||
in
|
||||
{
|
||||
imports = [ # Include the results of the hardware scan.
|
||||
|
@ -148,6 +149,14 @@ in
|
|||
client_max_body_size 200M;
|
||||
'';
|
||||
};
|
||||
locations."/cam/stream" = {
|
||||
proxyPass = "http://localhost:8081/video.mjpg";
|
||||
extraConfig = "proxy_pass_request_headers off;";
|
||||
};
|
||||
locations."/cam/capture" = {
|
||||
proxyPass = "${espCam}/capture";
|
||||
extraConfig = "proxy_pass_request_headers off;";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -181,10 +190,20 @@ in
|
|||
# Allow access to printer serial port and GPIO
|
||||
users.users.${config.services.octoprint.user}.extraGroups = [ "dialout" "gpio" ];
|
||||
|
||||
# services.mjpg-streamer = {
|
||||
# enable = true;
|
||||
# inputPlugin = "input_uvc.so -r 1280x720";
|
||||
# };
|
||||
systemd.services.mjpeg-stream =
|
||||
let
|
||||
httpbounder = pkgs.callPackage <lib/pkgs/httpbounder.nix> {};
|
||||
in {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
serviceConfig = {
|
||||
User = "nobody";
|
||||
Group = "nogroup";
|
||||
Restart = "always";
|
||||
RestartSec = 60;
|
||||
};
|
||||
script = "exec ${httpbounder}/bin/httpbounder -b 127.0.0.1:8081 -i ${espCam}/stream";
|
||||
};
|
||||
|
||||
# Allow gpio group to access GPIO devices
|
||||
users.groups.gpio = { };
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
{ fetchFromGitHub, rustPlatform, pkg-config, openssl }:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "httpbounder";
|
||||
version = "unstable-2020-10-23";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Szperak";
|
||||
repo = "httpbounder";
|
||||
rev = "540d8e8beea5b75c2761ab3500464f1ebdebbc4f";
|
||||
sha256 = "0m0q3835055xr2pq6726f9pp9ws1q6mwhfmgkylsagzzkrcpmnar";
|
||||
};
|
||||
cargoPatches = [ ./httpbounder.patch ];
|
||||
|
||||
cargoSha256 = "137zl2d2pr5p4zr6a8rrbc52izz25yh6cgilvag4fvnhgwv986c0";
|
||||
nativeBuildInputs = [ pkg-config ];
|
||||
buildInputs = [ openssl ];
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue