pulsebert: double-proxy the espCam
This commit is contained in:
parent
c06710cf18
commit
71495bc257
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
octoprintPort = 8080;
|
octoprintPort = 8080;
|
||||||
|
espCam = "http://172.20.78.164:81";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ # Include the results of the hardware scan.
|
imports = [ # Include the results of the hardware scan.
|
||||||
|
@ -148,6 +149,14 @@ in
|
||||||
client_max_body_size 200M;
|
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
|
# Allow access to printer serial port and GPIO
|
||||||
users.users.${config.services.octoprint.user}.extraGroups = [ "dialout" "gpio" ];
|
users.users.${config.services.octoprint.user}.extraGroups = [ "dialout" "gpio" ];
|
||||||
|
|
||||||
# services.mjpg-streamer = {
|
systemd.services.mjpeg-stream =
|
||||||
# enable = true;
|
let
|
||||||
# inputPlugin = "input_uvc.so -r 1280x720";
|
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
|
# Allow gpio group to access GPIO devices
|
||||||
users.groups.gpio = { };
|
users.groups.gpio = { };
|
||||||
|
|
18
lib/pkgs/httpbounder.nix
Normal file
18
lib/pkgs/httpbounder.nix
Normal file
|
@ -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 ];
|
||||||
|
}
|
2325
lib/pkgs/httpbounder.patch
Normal file
2325
lib/pkgs/httpbounder.patch
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user