From 211106cf539c501067e96dd8b3f072f0945d7f7d Mon Sep 17 00:00:00 2001 From: Astro Date: Sun, 21 Feb 2021 23:44:21 +0100 Subject: [PATCH] pulsebert: migrate from httpbounder to rust-mjpeg-proxy --- hosts/pulsebert/configuration.nix | 8 ++++---- lib/pkgs/mjpeg-proxy.nix | 18 ++++++++---------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/hosts/pulsebert/configuration.nix b/hosts/pulsebert/configuration.nix index 14574948..d43cd6cc 100644 --- a/hosts/pulsebert/configuration.nix +++ b/hosts/pulsebert/configuration.nix @@ -152,11 +152,11 @@ in ''; }; locations."/cam/stream" = { - proxyPass = "http://localhost:8081/video.mjpg"; + proxyPass = "http://localhost:3030/stream.mjpeg"; extraConfig = "proxy_pass_request_headers off;"; }; locations."/cam/capture" = { - proxyPass = "${espCam}/capture"; + proxyPass = "http://localhost:3030/capture.jpg"; extraConfig = "proxy_pass_request_headers off;"; }; }; @@ -194,7 +194,7 @@ in systemd.services.mjpeg-stream = let - httpbounder = pkgs.callPackage {}; + mjpeg-proxy = pkgs.callPackage {}; in { wantedBy = [ "multi-user.target" ]; after = [ "network.target" ]; @@ -204,7 +204,7 @@ in Restart = "always"; RestartSec = 60; }; - script = "exec ${httpbounder}/bin/httpbounder -b 127.0.0.1:8081 -i ${espCam}/stream"; + script = "exec ${mjpeg-proxy}/bin/rust-mjpeg-proxy ${espCam}/stream"; }; # Allow gpio group to access GPIO devices diff --git a/lib/pkgs/mjpeg-proxy.nix b/lib/pkgs/mjpeg-proxy.nix index 89fa169c..b8039459 100644 --- a/lib/pkgs/mjpeg-proxy.nix +++ b/lib/pkgs/mjpeg-proxy.nix @@ -1,18 +1,16 @@ -{ fetchFromGitHub, rustPlatform, pkg-config, openssl }: +{ fetchgit, rustPlatform, pkg-config, openssl }: rustPlatform.buildRustPackage rec { - pname = "httpbounder"; - version = "unstable-2020-10-23"; + pname = "rust-mjpeg-proxy"; + version = "unstable-2021-02-21"; - src = fetchFromGitHub { - owner = "Szperak"; - repo = "httpbounder"; - rev = "540d8e8beea5b75c2761ab3500464f1ebdebbc4f"; - sha256 = "0m0q3835055xr2pq6726f9pp9ws1q6mwhfmgkylsagzzkrcpmnar"; + src = fetchgit { + url = "https://gitea.c3d2.de/astro/rust-mjpeg-proxy.git"; + rev = "d64611c0c3f91ff594054110197db097b649782d"; + sha256 = "004hgaq046lq0d1mn46p5g17qll18k5ssm4igwfi0k98lc2l3s8x"; }; - cargoPatches = [ ./httpbounder.patch ]; - cargoSha256 = "137zl2d2pr5p4zr6a8rrbc52izz25yh6cgilvag4fvnhgwv986c0"; + cargoSha256 = "1lsrzgszag9g93s3wqm3h1jbsh5dsik4gp7ci3lgmlb4h94ziqn2"; nativeBuildInputs = [ pkg-config ]; buildInputs = [ openssl ]; }