Merge branch 'devel' of gitlab.univ-nantes.fr:glicid-public/guix-glicid into devel

This commit is contained in:
Jean-François GUILLAUME 2023-01-05 16:09:03 +01:00
commit 8876d01e5e
GPG key ID: 38751DAE145EFB5A

View file

@ -1,323 +1,254 @@
(define-module (glicid packages nginx) (define-module (glicid packages nginx)
#:use-module (ice-9 match) #:use-module (ice-9 match)
#:use-module (guix) #:use-module (guix)
#:use-module (guix build-system gnu) #:use-module (guix build-system gnu)
#:use-module (guix download) #:use-module (guix download)
#:use-module (guix git-download) #:use-module (guix git-download)
#:use-module ((guix licenses) #:use-module ((guix licenses) #:prefix license:)
#:prefix license:) #:use-module (guix utils)
#:use-module (guix utils) #:use-module (gnu packages compression)
#:use-module (gnu packages compression) #:use-module (gnu packages curl)
#:use-module (gnu packages curl) #:use-module (gnu packages geo)
#:use-module (gnu packages geo) #:use-module (gnu packages pcre)
#:use-module (gnu packages pcre) #:use-module (gnu packages perl)
#:use-module (gnu packages perl) #:use-module (gnu packages pkg-config)
#:use-module (gnu packages pkg-config) #:use-module (gnu packages web)
#:use-module (gnu packages web) #:use-module (gnu packages xml)
#:use-module (gnu packages xml) #:use-module (gnu packages tls)
#:use-module (gnu packages tls) #:use-module (glicid packages openldap))
#:use-module (glicid packages openldap))
(define-public nginx (define-public nginx
(package (package
(name "nginx") (name "nginx")
(version "1.23.2") (version "1.23.3")
(source (origin (source (origin
(method url-fetch) (method url-fetch)
(uri (string-append "https://nginx.org/download/nginx-" version (uri (string-append "https://nginx.org/download/nginx-" version ".tar.gz"))
".tar.gz")) (sha256 (base32 "0m5s8a04jlpv6qhk09sfqbj4rxj38g6923w12j5y3ymrvf3mgjvm"))))
(sha256 (build-system gnu-build-system)
(base32 (inputs (list libxml2 libxslt openssl pcre zlib))
"0ihbkfcqlqadzkdk813raq15qqrahss1gdd81bkswanpsdrc4358")))) (arguments
(build-system gnu-build-system) `(#:tests? #f
(inputs (list libxml2 libxslt openssl pcre zlib)) #:phases (modify-phases %standard-phases
(arguments (add-before 'configure 'patch-/bin/sh
`(#:tests? #f (lambda _ (substitute* "auto/feature" (("/bin/sh") (which "sh"))) #t))
#:phases (modify-phases %standard-phases (replace 'configure
(add-before 'configure 'patch-/bin/sh (lambda* (#:key configure-flags inputs outputs #:allow-other-keys)
(lambda _ (let ((flags (append (list
(substitute* "auto/feature" (string-append "--prefix=" (assoc-ref outputs "out"))
(("/bin/sh") "--with-http_ssl_module"
(which "sh"))) #t)) "--with-http_v2_module"
(replace 'configure "--with-http_xslt_module"
;; The configure script is hand-written, not from GNU autotools. "--with-http_gzip_static_module"
(lambda* (#:key configure-flags inputs outputs "--with-http_gunzip_module"
#:allow-other-keys) "--with-http_addition_module"
(let ((flags (append (list (string-append "--prefix=" "--with-http_sub_module"
(assoc-ref "--with-pcre-jit"
outputs "out")) "--with-debug"
"--with-http_ssl_module" "--with-stream"
"--with-http_v2_module" ,(let ((system "Linux")
"--with-http_xslt_module" (release "3.2.0")
"--with-http_gzip_static_module" (machine (match (or (%current-target-system) (%current-system))
"--with-http_gunzip_module" ("x86_64-linux" "x86_64")
"--with-http_addition_module" ("i686-linux" "i686")
"--with-http_sub_module" ("mips64el-linux" "mips64")
"--with-pcre-jit" (_ "UNSUPPORTED"))))
"--with-debug" (string-append "--crossbuild=" system ":" release ":" machine)))
"--with-stream" configure-flags)))
;; Even when not cross-building, we pass the (setenv "CC" ,(cc-for-target))
;; --crossbuild option to avoid customizing for the (setenv "CFLAGS" (string-append "-I" (assoc-ref inputs "libxml2") "/include/libxml2"))
;; kernel version on the build machine. (format #t "configure flags: ~s~%" flags)
,(let ((system "Linux") (apply invoke "./configure" flags) #t)))
;uname -s (add-after 'install 'install-man-page
(release "3.2.0") ;uname -r (lambda* (#:key outputs #:allow-other-keys)
;; uname -m (let* ((out (assoc-ref outputs "out"))
(machine (match (or (%current-target-system) (man (string-append out "/share/man")))
(%current-system)) (install-file "objs/nginx.8"
("x86_64-linux" (string-append man "/man8")) #t)))
"x86_64") (add-after 'install 'fix-root-dirs
("i686-linux" (lambda* (#:key outputs #:allow-other-keys)
"i686") (let* ((out (assoc-ref outputs "out"))
("mips64el-linux" (share (string-append out "/share/nginx")))
"mips64") (rmdir (string-append out "/logs"))
(_ "UNSUPPORTED")))) (mkdir-p share)
(string-append "--crossbuild=" (rename-file (string-append out "/conf")
system (string-append share "/conf"))
":" (rename-file (string-append out "/html")
release (string-append share "/html")) #t))))))
":" (home-page "https://nginx.org")
machine))) (synopsis "HTTP and reverse proxy server")
configure-flags))) (description
(setenv "CC" "Nginx (\"engine X\") is a high-performance web and reverse proxy server
,(cc-for-target))
(setenv "CFLAGS" ;CPPFLAGS is not respected
(string-append "-I"
(assoc-ref inputs "libxml2")
"/include/libxml2"))
(format #t "configure flags: ~s~%" flags)
(apply invoke "./configure" flags) #t)))
(add-after 'install 'install-man-page
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(man (string-append out "/share/man")))
(install-file "objs/nginx.8"
(string-append man "/man8")) #t)))
(add-after 'install 'fix-root-dirs
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(share (string-append out "/share/nginx")))
(rmdir (string-append out "/logs"))
(mkdir-p share)
(rename-file (string-append out "/conf")
(string-append share "/conf"))
(rename-file (string-append out "/html")
(string-append share "/html")) #t))))))
(home-page "https://nginx.org")
(synopsis "HTTP and reverse proxy server")
(description
"Nginx (\"engine X\") is a high-performance web and reverse proxy server
created by Igor Sysoev. It can be used both as a stand-alone web server created by Igor Sysoev. It can be used both as a stand-alone web server
and as a proxy to reduce the load on back-end HTTP or mail servers.") and as a proxy to reduce the load on back-end HTTP or mail servers.")
(license (list license:bsd-2 license:expat license:bsd-3 license:bsd-4)))) (license (list license:bsd-2 license:expat license:bsd-3 license:bsd-4))))
(define-public nginx-ldap-auth-module (define-public nginx-ldap-auth-module
(package (package
(inherit nginx) (inherit nginx)
(name "nginx-ldap-auth-module") (name "nginx-ldap-auth-module")
(version "83c059b73566c2ee9cbda920d91b66657cf120b7") (version "83c059b")
(source (origin (source (origin
(method git-fetch) (method url-fetch)
(uri (git-reference (uri (list (string-append "https://github.com/kvspb/nginx-auth-ldap/archive/" version ".tar.gz")))
(url "https://github.com/kvspb/nginx-auth-ldap") (sha256 (base32 "0r44dhsbw2ssg84vc5i68zdnhd0131nkbkbmxq7rpq9avddlw339"))))
(commit version))) (synopsis "LDAP Authentication module for nginx")
(file-name (git-file-name "nginx-ldap-auth-module" version)) (description
(sha256 "LDAP module for nginx which supports authentication against multiple LDAP servers.")
(base32 (build-system gnu-build-system)
"023zmdir7w92dnb508ggskkc7kmd7k71hc597sb7i4xfgpwxzq1s")))) (inputs `(("nginx-sources" ,(package-source nginx))
(synopsis "LDAP Authentication module for nginx") ("openldap" ,openldap)
(description ,@(package-inputs nginx)))
"LDAP module for nginx which supports authentication against multiple LDAP servers.") (arguments
(build-system gnu-build-system) (substitute-keyword-arguments `(#:configure-flags '("--add-dynamic-module=.")
(inputs `(("nginx-sources" ,(package-source nginx)) #:make-flags '("modules")
("openldap" ,openldap) ,@(package-arguments nginx))
,@(package-inputs nginx))) ((#:phases phases)
(arguments `(modify-phases ,phases
(substitute-keyword-arguments `(#:configure-flags '("--add-dynamic-module=.") (add-after 'unpack 'unpack-nginx-sources
#:make-flags '("modules") (lambda* (#:key inputs native-inputs #:allow-other-keys)
,@(package-arguments nginx)) (begin
((#:phases phases) (format #t "decompressing nginx source code~%")
`(modify-phases ,phases (let ((tar (assoc-ref inputs "tar"))
(add-after 'unpack 'unpack-nginx-sources (nginx-srcs (assoc-ref inputs "nginx-sources")))
(lambda* (#:key inputs native-inputs #:allow-other-keys) (invoke (string-append tar "/bin/tar") "xvf" nginx-srcs
(begin "--strip-components=1")) #t)))
(format #t "decompressing nginx source code~%") (replace 'install
(let ((tar (assoc-ref inputs "tar")) (lambda* (#:key outputs #:allow-other-keys)
(nginx-srcs (assoc-ref inputs "nginx-sources"))) (let ((modules-dir (string-append (assoc-ref outputs "out")
(invoke (string-append tar "/bin/tar") "xvf" nginx-srcs "/etc/nginx/modules")))
"--strip-components=1")) #t))) (install-file "objs/ngx_http_auth_ldap_module.so" modules-dir)
(replace 'install #t)))
(lambda* (#:key outputs #:allow-other-keys) (delete 'fix-root-dirs)
(let ((modules-dir (string-append (assoc-ref outputs "out") (delete 'install-man-page)))))))
"/etc/nginx/modules")))
(install-file "objs/ngx_http_auth_ldap_module.so" modules-dir)
#t)))
(delete 'fix-root-dirs)
(delete 'install-man-page)))))))
(define-public modsecurity (define-public modsecurity
(package (package
(name "modsecurity") (name "modsecurity")
(version "3.0.8") (version "3.0.8")
(source (origin (source (origin
(method url-fetch) (method url-fetch)
(uri (list (string-append (uri (list (string-append "https://github.com/SpiderLabs/ModSecurity/releases/download/v" version "/modsecurity-v" version ".tar.gz")))
"https://github.com/SpiderLabs/ModSecurity/releases/download/v" (sha256 (base32 "1isng4z2xijqq92105si1zxkzlx4ifdnn38d7n38mrfp7jdwhhg2"))))
version "/modsecurity-v" version ".tar.gz"))) (synopsis "modsecurity module for nginx")
(sha256 (description "modsecurity module for nginx.")
(base32 (license license:asl2.0)
"1isng4z2xijqq92105si1zxkzlx4ifdnn38d7n38mrfp7jdwhhg2")))) (home-page "https://github.com/SpiderLabs/ModSecurity")
(synopsis "modsecurity module for nginx") (build-system gnu-build-system)
(description "modsecurity module for nginx.") (inputs `(("curl" ,curl)
(license license:asl2.0) ("libxml2" ,libxml2)
(home-page "https://github.com/SpiderLabs/ModSecurity") ("libxslt" ,libxslt)
(build-system gnu-build-system) ("openssl" ,openssl)
(inputs `(("curl" ,curl) ("pcre" ,pcre)
("libxml2" ,libxml2) ("pcre:bin" ,pcre "bin")
("libxslt" ,libxslt) ("zlib" ,zlib)
("openssl" ,openssl) ("pkg-config" ,pkg-config)
("pcre" ,pcre) ("nginx-sources" ,(package-source nginx))))
("pcre:bin" ,pcre "bin") (arguments
("zlib" ,zlib) `(#:configure-flags (list (string-append "--with-curl=" (assoc-ref %build-inputs "curl"))
("pkg-config" ,pkg-config) (string-append "--with-pcre=" (assoc-ref %build-inputs "pcre:bin") "/bin/pcre-config")
("nginx-sources" ,(package-source nginx)))) (string-append "--with-libxml=" (assoc-ref %build-inputs "libxml2"))
(arguments "--enable-standalone-module")))))
`(#:configure-flags (list (string-append "--with-curl="
(assoc-ref %build-inputs "curl"))
(string-append "--with-pcre="
(assoc-ref %build-inputs
"pcre:bin")
"/bin/pcre-config")
(string-append "--with-libxml="
(assoc-ref %build-inputs
"libxml2"))
"--enable-standalone-module")))))
(define-public nginx-modsecurity-module (define-public nginx-modsecurity-module
(package (package
(inherit nginx) (inherit nginx)
(name "nginx-modsecurity-module") (name "nginx-modsecurity-module")
(version "1.0.3") (version "1.0.3")
(source (origin (source (origin
(method url-fetch) (method url-fetch)
(uri (list (string-append (uri (list (string-append "https://github.com/SpiderLabs/ModSecurity-nginx/releases/download/v" version "/modsecurity-nginx-v" version ".tar.gz")))
"https://github.com/SpiderLabs/ModSecurity-nginx/releases/download/v" (sha256 (base32 "1pcayz0kkpr0fvs8fwai0xv7jw9r7ph66vwxm6vrq0mc11r1r0df"))))
version "/modsecurity-nginx-v" version ".tar.gz"))) (synopsis "ModSecurity module for nginx")
(sha256 (description "ModSecurity module for nginx.")
(base32 (build-system gnu-build-system)
"1pcayz0kkpr0fvs8fwai0xv7jw9r7ph66vwxm6vrq0mc11r1r0df")))) (inputs `(("nginx-sources" ,(package-source nginx))
(synopsis "ModSecurity module for nginx") ("modsecurity" ,modsecurity)
(description "ModSecurity module for nginx.") ,@(package-inputs nginx)))
(build-system gnu-build-system) (arguments
(inputs `(("nginx-sources" ,(package-source nginx)) (substitute-keyword-arguments `(#:configure-flags '("--add-dynamic-module=.")
("modsecurity" ,modsecurity) #:make-flags '("modules")
,@(package-inputs nginx))) ,@(package-arguments nginx))
(arguments ((#:phases phases)
(substitute-keyword-arguments `(#:configure-flags '("--add-dynamic-module=.") `(modify-phases ,phases
#:make-flags '("modules") (add-after 'unpack 'unpack-nginx-sources
,@(package-arguments nginx)) (lambda* (#:key inputs native-inputs #:allow-other-keys)
((#:phases phases) (begin
`(modify-phases ,phases (format #t "decompressing nginx source code~%")
(add-after 'unpack 'unpack-nginx-sources (let ((tar (assoc-ref inputs "tar")) (nginx-srcs (assoc-ref inputs "nginx-sources")))
(lambda* (#:key inputs native-inputs #:allow-other-keys) (invoke (string-append tar "/bin/tar") "xvf" nginx-srcs "--strip-components=1")) #t)))
(begin (replace 'install
;; The nginx source code is part of the modules source. (lambda* (#:key outputs #:allow-other-keys)
(format #t "decompressing nginx source code~%") (let ((modules-dir (string-append (assoc-ref outputs "out") "/etc/nginx/modules")))
(let ((tar (assoc-ref inputs "tar")) (install-file "objs/ngx_http_modsecurity_module.so" modules-dir) #t)))
(nginx-srcs (assoc-ref inputs "nginx-sources"))) (delete 'fix-root-dirs)
(invoke (string-append tar "/bin/tar") "xvf" nginx-srcs (delete 'install-man-page)))))))
"--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_http_modsecurity_module.so"
modules-dir) #t)))
(delete 'fix-root-dirs)
(delete 'install-man-page)))))))
(define-public nginx-geoip2-module (define-public nginx-geoip2-module
(package (package
(inherit nginx) (inherit nginx)
(name "nginx-geoip2-module") (name "nginx-geoip2-module")
(version "3.4") (version "3.4")
(source (origin (source (origin
(method url-fetch) (method url-fetch)
(uri (list (string-append (uri (list (string-append "https://github.com/leev/ngx_http_geoip2_module/archive/refs/tags/" version ".tar.gz")))
"https://github.com/leev/ngx_http_geoip2_module/archive/refs/tags/" (sha256 (base32 "0lllgnasd97r6xkj70q42rp61cxrz8qlb64l14rmlwcd6hizqwmd"))))
version ".tar.gz"))) (synopsis "GeoIP2 module for nginx")
(sha256 (description "GeoIP2 module for nginx.")
(base32 (build-system gnu-build-system)
"0lllgnasd97r6xkj70q42rp61cxrz8qlb64l14rmlwcd6hizqwmd")))) (inputs `(("nginx-sources" ,(package-source nginx))
(synopsis "GeoIP2 module for nginx") ("libmaxminddb" ,libmaxminddb)
(description "GeoIP2 module for nginx.") ,@(package-inputs nginx)))
(build-system gnu-build-system) (arguments
(inputs `(("nginx-sources" ,(package-source nginx)) (substitute-keyword-arguments `(#:configure-flags '("--add-dynamic-module=.")
("libmaxminddb" ,libmaxminddb) #:make-flags '("modules")
,@(package-inputs nginx))) ,@(package-arguments nginx))
(arguments ((#:phases phases)
(substitute-keyword-arguments `(#:configure-flags '("--add-dynamic-module=.") `(modify-phases ,phases
#:make-flags '("modules") (add-after 'unpack 'unpack-nginx-sources
,@(package-arguments nginx)) (lambda* (#:key inputs native-inputs #:allow-other-keys)
((#:phases phases) (begin
`(modify-phases ,phases (format #t "decompressing nginx source code~%")
(add-after 'unpack 'unpack-nginx-sources (let ((tar (assoc-ref inputs "tar")) (nginx-srcs (assoc-ref inputs "nginx-sources")))
(lambda* (#:key inputs native-inputs #:allow-other-keys) (invoke (string-append tar "/bin/tar") "xvf" nginx-srcs "--strip-components=1")) #t)))
(begin (replace 'install
;; The nginx source code is part of the modules source. (lambda* (#:key outputs #:allow-other-keys)
(format #t "decompressing nginx source code~%") (let ((modules-dir (string-append (assoc-ref outputs "out") "/etc/nginx/modules")))
(let ((tar (assoc-ref inputs "tar")) (install-file "objs/ngx_http_geoip2_module.so" modules-dir)
(nginx-srcs (assoc-ref inputs "nginx-sources"))) (install-file "objs/ngx_stream_geoip2_module.so" modules-dir)
(invoke (string-append tar "/bin/tar") "xvf" nginx-srcs #t)))
"--strip-components=1")) #t))) (delete 'fix-root-dirs)
(replace 'install (delete 'install-man-page)))))))
(lambda* (#:key outputs #:allow-other-keys)
(let ((modules-dir (string-append (assoc-ref outputs "out")
"/etc/nginx/modules")))
(install-file "objs/ngx_http_geoip2_module.so" modules-dir)
(install-file "objs/ngx_stream_geoip2_module.so" modules-dir)
#t)))
(delete 'fix-root-dirs)
(delete 'install-man-page)))))))
(define-public nginx-http_subs_filter-module (define-public nginx-http_subs_filter-module
(package (package
(inherit nginx) (inherit nginx)
(name "nginx-http_subs_filter-module") (name "nginx-http_subs_filter-module")
(version "e12e965") (version "e12e965")
(source (origin (source (origin
(method url-fetch) (method url-fetch)
(uri (list (string-append (uri (list (string-append "https://github.com/yaoweibin/ngx_http_substitutions_filter_module/archive/" version ".tar.gz")))
"https://github.com/yaoweibin/ngx_http_substitutions_filter_module/archive/" (sha256 (base32 "1cxb3yv6085rj50s001p2vblvz5px2v92whwjhb14kl8fnm2cans"))))
version ".tar.gz"))) (synopsis "substitutions_filter module for nginx")
(sha256 (description "substitutions_filter module for nginx.")
(base32 (build-system gnu-build-system)
"1cxb3yv6085rj50s001p2vblvz5px2v92whwjhb14kl8fnm2cans")))) (inputs `(("nginx-sources" ,(package-source nginx))
(synopsis "substitutions_filter module for nginx") ,@(package-inputs nginx)))
(description "substitutions_filter module for nginx.") (arguments
(build-system gnu-build-system) (substitute-keyword-arguments `(#:configure-flags '("--add-dynamic-module=.")
(inputs `(("nginx-sources" ,(package-source nginx)) #:make-flags '("modules")
,@(package-inputs nginx))) ,@(package-arguments nginx))
(arguments ((#:phases phases)
(substitute-keyword-arguments `(#:configure-flags '("--add-dynamic-module=.") `(modify-phases ,phases
#:make-flags '("modules") (add-after 'unpack 'unpack-nginx-sources
,@(package-arguments nginx)) (lambda* (#:key inputs native-inputs #:allow-other-keys)
((#:phases phases) (begin
`(modify-phases ,phases (format #t "decompressing nginx source code~%")
(add-after 'unpack 'unpack-nginx-sources (let ((tar (assoc-ref inputs "tar")) (nginx-srcs (assoc-ref inputs "nginx-sources")))
(lambda* (#:key inputs native-inputs #:allow-other-keys) (invoke (string-append tar "/bin/tar") "xvf" nginx-srcs "--strip-components=1")) #t)))
(begin (replace 'install
;; The nginx source code is part of the modules source. (lambda* (#:key outputs #:allow-other-keys)
(format #t "decompressing nginx source code~%") (let ((modules-dir (string-append (assoc-ref outputs "out") "/etc/nginx/modules")))
(let ((tar (assoc-ref inputs "tar")) (install-file "objs/ngx_http_subs_filter_module.so" modules-dir) #t)))
(nginx-srcs (assoc-ref inputs "nginx-sources"))) (delete 'fix-root-dirs)
(invoke (string-append tar "/bin/tar") "xvf" nginx-srcs (delete 'install-man-page)))))))
"--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_http_subs_filter_module.so"
modules-dir) #t)))
(delete 'fix-root-dirs)
(delete 'install-man-page)))))))