mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-04 22:10:14 +00:00
nginx: make module source trees writable
The config script of multiple nginx modules must be able to write into its source tree, so let's accumulate this logic once in nginx instead of in multiple modules.
This commit is contained in:
@@ -167,8 +167,7 @@ stdenv.mkDerivation {
|
||||
++ lib.optional (
|
||||
stdenv.buildPlatform != stdenv.hostPlatform
|
||||
) "--crossbuild=${stdenv.hostPlatform.uname.system}::${stdenv.hostPlatform.uname.processor}"
|
||||
++ configureFlags
|
||||
++ map (mod: "--add-module=${mod}") modules;
|
||||
++ configureFlags;
|
||||
|
||||
env = {
|
||||
NIX_CFLAGS_COMPILE = toString (
|
||||
@@ -209,6 +208,15 @@ stdenv.mkDerivation {
|
||||
preConfigure = ''
|
||||
setOutputFlags=
|
||||
''
|
||||
# Make all modules source trees writable
|
||||
+ ''
|
||||
for module in ${toString modules}; do
|
||||
dst="$NIX_BUILD_TOP/$(basename "$module")"
|
||||
cp --recursive "$module" "$dst"
|
||||
chmod --recursive +w "$dst"
|
||||
appendToVar configureFlags "--add-module=$dst"
|
||||
done
|
||||
''
|
||||
+ preConfigure
|
||||
+ lib.concatMapStringsSep "\n" (mod: mod.preConfigure or "") modules;
|
||||
|
||||
|
||||
@@ -21,13 +21,6 @@ mkNginxPlugin (finalAttrs: {
|
||||
preConfigure = ''
|
||||
export LUAJIT_LIB="${luajit_openresty}/lib"
|
||||
export LUAJIT_INC="$(realpath ${luajit_openresty}/include/luajit-*)"
|
||||
|
||||
# make source directory writable to allow generating src/ngx_http_lua_autoconf.h
|
||||
lua_src=$TMPDIR/lua-src
|
||||
cp -r "${finalAttrs.src}/" "$lua_src"
|
||||
chmod -R +w "$lua_src"
|
||||
export configureFlags="''${configureFlags//"${finalAttrs.src}"/"$lua_src"}"
|
||||
unset lua_src
|
||||
'';
|
||||
|
||||
allowMemoryWriteExecute = true;
|
||||
|
||||
@@ -18,17 +18,6 @@ mkNginxPlugin (finalAttrs: {
|
||||
hash = "sha256-Ee55QKaeZ0mYGKUroKr/AYGoOCakEonU483qkhmZdzU=";
|
||||
};
|
||||
|
||||
# njs module sources have to be writable during nginx build, so we copy them
|
||||
# to a temporary directory and change the module path in the configureFlags
|
||||
preConfigure = ''
|
||||
NJS_SOURCE_DIR=$(readlink -m "$TMPDIR/${finalAttrs.src}")
|
||||
mkdir -p "$(dirname "$NJS_SOURCE_DIR")"
|
||||
cp --recursive "${finalAttrs.src}" "$NJS_SOURCE_DIR"
|
||||
chmod -R u+rwX,go+rX "$NJS_SOURCE_DIR"
|
||||
export configureFlags="''${configureFlags/"${finalAttrs.src}"/"$NJS_SOURCE_DIR/nginx"} --with-ld-opt='-lz'"
|
||||
unset NJS_SOURCE_DIR
|
||||
'';
|
||||
|
||||
buildInputs = [
|
||||
which
|
||||
zlib
|
||||
|
||||
Reference in New Issue
Block a user