From aa9eb4509c2bb0c258f84d3d465096888c1e0565 Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov Date: Sun, 8 May 2022 17:36:26 -0400 Subject: nginx-doc-unstable: init at 2022-05-05 Build documentation of nginx (which is maintained separately from webserver itself) and make it available both as "nginx-doc" attribute and as "doc" output of "nginx" derivation. --- pkgs/data/documentation/nginx-doc/default.nix | 40 ++++++++++++++++++++++ .../nginx-doc/exclude-google-analytics.patch | 29 ++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 pkgs/data/documentation/nginx-doc/default.nix create mode 100644 pkgs/data/documentation/nginx-doc/exclude-google-analytics.patch (limited to 'pkgs/data/documentation') diff --git a/pkgs/data/documentation/nginx-doc/default.nix b/pkgs/data/documentation/nginx-doc/default.nix new file mode 100644 index 0000000000000..c367912d6f982 --- /dev/null +++ b/pkgs/data/documentation/nginx-doc/default.nix @@ -0,0 +1,40 @@ +{ lib, stdenv, libxml2, libxslt, fetchhg }: + +# Upstream maintains documentation (sources of https://nginx.org) in separate +# mercurial repository, which do not correspond to particular git commit, but at +# least has "introduced in version X.Y" comments. +# +# In other words, documentation does not necessary matches capabilities of +# $out/bin/nginx, but we have no better options. +stdenv.mkDerivation { + pname = "nginx-doc-unstable"; + version = "2022-05-05"; + src = fetchhg { + url = "https://hg.nginx.org/nginx.org"; + rev = "a3aee2697d4e"; + sha256 = "029n4mnmjw94h01qalmjgf1c2h3h7wm798xv5knk3padxiy4m28b"; + }; + patches = [ ./exclude-google-analytics.patch ]; + nativeBuildInputs = [ libxslt libxml2 ]; + + # Generated documentation is not local-friendly, since it assumes that link to directory + # is the same as link to index.html in that directory, which is not how browsers behave + # with local filesystem. + # + # TODO: patch all relative links that do not end with .html. + + # /en subdirectory must exist, relative links expect it. + installPhase = '' + mkdir -p $out/share/doc/nginx + mv libxslt/en $out/share/doc/nginx + ''; + + meta = with lib; { + description = "A reverse proxy and lightweight webserver (documentation)"; + homepage = "https://nginx.org/"; + license = licenses.bsd2; + platforms = platforms.all; + priority = 6; + maintainers = with maintainers; [ kaction ]; + }; +} diff --git a/pkgs/data/documentation/nginx-doc/exclude-google-analytics.patch b/pkgs/data/documentation/nginx-doc/exclude-google-analytics.patch new file mode 100644 index 0000000000000..c2f3f520c3d10 --- /dev/null +++ b/pkgs/data/documentation/nginx-doc/exclude-google-analytics.patch @@ -0,0 +1,29 @@ +Kill google analytics from local documentation. + +diff -r bb0a2fbdc886 xslt/ga.xslt +--- a/xslt/ga.xslt Mon Apr 06 11:17:11 2020 +0100 ++++ b/xslt/ga.xslt Thu Apr 09 10:29:02 2020 -0400 +@@ -6,23 +6,6 @@ + + + +- +- +- + + + -- cgit 1.4.1