summary refs log tree commit diff
diff options
context:
space:
mode:
authorJack Hill <jackhill@jackhill.us>2021-07-22 16:55:56 -0400
committerLudovic Courtès <ludo@gnu.org>2021-07-29 21:54:55 +0200
commit00c55e856f532ef845f78144fdf2ff938ca3dffd (patch)
tree3436901f6cde93a92a8099cc980047e682ef850a
parentb402a3ec86ebac4df4eed6a4030923bc62683d1d (diff)
downloadguix-00c55e856f532ef845f78144fdf2ff938ca3dffd.tar.gz
gnu: Add nginx-rtmp-module.
* gnu/packages/web.scm (nginx-rtmp-module): New variable.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r--gnu/packages/web.scm59
1 files changed, 59 insertions, 0 deletions
diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index c59c4abb13..42827bc201 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -51,6 +51,7 @@
 ;;; Copyright © 2021 la snesne <lasnesne@lagunposprasihopre.org>
 ;;; Copyright © 2021 Matthew James Kraai <kraai@ftbfs.org>
 ;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
+;;; Copyright © 2021 Jack Hill <jackhill@jackhill.us>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -773,6 +774,64 @@ documentation.")
     (description "This NGINX module provides a scripting support with Lua
 programming language.")))
 
+(define-public nginx-rtmp-module
+  (package
+    (inherit nginx)
+    (name "nginx-rtmp-module")
+    (version "1.2.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/arut/nginx-rtmp-module")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0y45bswk213yhkc2v1xca2rnsxrhx8v6azxz9pvi71vvxcggqv6h"))))
+    (build-system gnu-build-system)
+    (inputs
+     `(("nginx-sources" ,(package-source nginx))
+       ,@(package-inputs nginx)))
+    (arguments
+     (substitute-keyword-arguments
+         `(#:configure-flags '("--add-dynamic-module=.")
+           #:make-flags '("modules")
+           #:modules ((guix build utils)
+                      (guix build gnu-build-system))
+           ,@(package-arguments nginx))
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (add-after 'unpack 'unpack-nginx-sources
+             (lambda* (#:key inputs native-inputs #:allow-other-keys)
+               (begin
+                 ;; The nginx source code is part of the module’s source.
+                 (format #t "decompressing nginx source code~%")
+                 (invoke "tar" "xvf" (assoc-ref inputs "nginx-sources")
+                         ;; This packages's LICENSE file would be
+                         ;; overwritten with the one from nginx when
+                         ;; unpacking the nginx source, so rename the nginx
+                         ;; one when unpacking.
+                         "--transform=s,/LICENSE$,/LICENSE.nginx,"
+                         "--strip-components=1")
+                 #t)))
+           (replace 'install
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let ((modules-dir (string-append (assoc-ref outputs "out")
+                                                 "/etc/nginx/modules")))
+                 (install-file "objs/ngx_rtmp_module.so" modules-dir)
+                 #t)))
+           (delete 'fix-root-dirs)
+           (delete 'install-man-page)))))
+    (home-page "https://github.com/arut/nginx-rtmp-module")
+    (synopsis "NGINX module for audio and video streaming with RTMP")
+    (description "This NGINX module provides streaming with the @acronym{RTMP,
+Real-Time Messaging Protocol}, @acronym{DASH, Dynamic Adaptive Streaming over HTTP},
+and @acronym{HLS, HTTP Live Streaming} protocols.  It allows NGINX to accept
+incoming RTMP streams for recording or redistribution.  It also supports
+on-demand streaming from a file on disk and pulling from an upstream RTMP
+stream.  Remote control of the module is possible over HTTP.")
+    (license license:bsd-2)))
+
 (define-public lighttpd
   (package
     (name "lighttpd")