about summary refs log tree commit diff
path: root/pkgs/development/interpreters/lua-5/wrapper.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/interpreters/lua-5/wrapper.nix')
-rw-r--r--pkgs/development/interpreters/lua-5/wrapper.nix19
1 files changed, 13 insertions, 6 deletions
diff --git a/pkgs/development/interpreters/lua-5/wrapper.nix b/pkgs/development/interpreters/lua-5/wrapper.nix
index 0459b67534d4..b9ac255d2432 100644
--- a/pkgs/development/interpreters/lua-5/wrapper.nix
+++ b/pkgs/development/interpreters/lua-5/wrapper.nix
@@ -11,13 +11,18 @@
 let
   env = let
     paths =  requiredLuaModules (extraLibs ++ [ lua ] );
-  in (buildEnv {
+  in buildEnv {
     name = "${lua.name}-env";
 
     inherit paths;
     inherit ignoreCollisions;
     extraOutputsToInstall = [ "out" ] ++ extraOutputsToInstall;
 
+    nativeBuildInputs = [
+      makeWrapper
+      (lua.pkgs.lua-setup-hook lua.LuaPathSearchPaths lua.LuaCPathSearchPaths)
+    ];
+
     # we create wrapper for the binaries in the different packages
     postBuild = ''
       if [ -L "$out/bin" ]; then
@@ -37,7 +42,12 @@ let
               rm -f "$out/bin/$prg"
               if [ -x "$prg" ]; then
                 nix_debug "Making wrapper $prg"
-                makeWrapper "$path/bin/$prg" "$out/bin/$prg" --suffix LUA_PATH ';' "$LUA_PATH"   --suffix LUA_CPATH ';' "$LUA_CPATH" ${lib.concatStringsSep " " makeWrapperArgs}
+                makeWrapper "$path/bin/$prg" "$out/bin/$prg" \
+                  --set-default LUA_PATH ";;" \
+                  --suffix LUA_PATH ';' "$LUA_PATH" \
+                  --set-default LUA_CPATH ";;" \
+                  --suffix LUA_CPATH ';' "$LUA_CPATH" \
+                  ${lib.concatStringsSep " " makeWrapperArgs}
               fi
             fi
           done
@@ -62,8 +72,5 @@ let
         '';
     };
     };
-  }).overrideAttrs (_: {
-    # Add extra deps needed for postBuild hook.
-    nativeBuildInputs = [ makeWrapper lua ];
-  });
+  };
 in env