about summary refs log tree commit diff
path: root/pkgs/servers/http/nginx/generic.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/servers/http/nginx/generic.nix')
-rw-r--r--pkgs/servers/http/nginx/generic.nix19
1 files changed, 16 insertions, 3 deletions
diff --git a/pkgs/servers/http/nginx/generic.nix b/pkgs/servers/http/nginx/generic.nix
index f6b91d77511ec..e189a7d2fdff6 100644
--- a/pkgs/servers/http/nginx/generic.nix
+++ b/pkgs/servers/http/nginx/generic.nix
@@ -1,4 +1,5 @@
-{ lib, stdenv, fetchurl, fetchpatch, openssl, zlib, pcre, libxml2, libxslt
+outer@{ lib, stdenv, fetchurl, fetchpatch, openssl, zlib, pcre, libxml2, libxslt
+, nginx-doc
 
 , nixosTests
 , substituteAll, gd, geoip, perl
@@ -23,6 +24,7 @@
 , preConfigure ? ""
 , postInstall ? null
 , meta ? null
+, nginx-doc ? outer.nginx-doc
 , passthru ? { tests = {}; }
 }:
 
@@ -44,6 +46,8 @@ stdenv.mkDerivation {
   inherit version;
   inherit nginxVersion;
 
+  outputs = ["out" "doc"];
+
   src = if src != null then src else fetchurl {
     url = "https://nginx.org/download/nginx-${version}.tar.gz";
     inherit sha256;
@@ -114,8 +118,12 @@ stdenv.mkDerivation {
 
   configurePlatforms = [];
 
-  preConfigure = preConfigure
-    + concatMapStringsSep "\n" (mod: mod.preConfigure or "") modules;
+  # Disable _multioutConfig hook which adds --bindir=$out/bin into configureFlags,
+  # which breaks build, since nginx does not actually use autoconf.
+  preConfigure = ''
+    setOutputFlags=
+  '' + preConfigure
+     + concatMapStringsSep "\n" (mod: mod.preConfigure or "") modules;
 
   patches = map fixPatch ([
     (substituteAll {
@@ -145,6 +153,11 @@ stdenv.mkDerivation {
 
   enableParallelBuilding = true;
 
+  preInstall = ''
+    mkdir -p $doc
+    cp -r ${nginx-doc}/* $doc
+  '';
+
   postInstall = if postInstall != null then postInstall else ''
     mv $out/sbin $out/bin
   '';