about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthieu Coudron <mattator@gmail.com>2020-02-27 11:01:30 +0100
committerGitHub <noreply@github.com>2020-02-27 11:01:30 +0100
commit7f821b3efc15072e91006416a1db6120555a5e24 (patch)
treee8027bd03d726c6a4f31f86d27d2dad0fbfbda26
parent39ed5ff74c17b8f494c41e2d556483b2bd08f852 (diff)
parent006aeb5704123f259d5cda435a991b3d72225b32 (diff)
downloadnixlib-7f821b3efc15072e91006416a1db6120555a5e24.tar
nixlib-7f821b3efc15072e91006416a1db6120555a5e24.tar.gz
nixlib-7f821b3efc15072e91006416a1db6120555a5e24.tar.bz2
nixlib-7f821b3efc15072e91006416a1db6120555a5e24.tar.lz
nixlib-7f821b3efc15072e91006416a1db6120555a5e24.tar.xz
nixlib-7f821b3efc15072e91006416a1db6120555a5e24.tar.zst
nixlib-7f821b3efc15072e91006416a1db6120555a5e24.zip
Merge pull request #81067 from teto/lua_fix
- introduce a default checkPhase for lua (disabled by default)
- dont apply patchShebangs on the whole lua package; hopefulyl it doesnt break stuff
-rw-r--r--pkgs/development/interpreters/lua-5/build-lua-package.nix22
-rw-r--r--pkgs/development/lua-modules/overrides.nix10
2 files changed, 20 insertions, 12 deletions
diff --git a/pkgs/development/interpreters/lua-5/build-lua-package.nix b/pkgs/development/interpreters/lua-5/build-lua-package.nix
index be7aa5fc09d7..98a98c0dd348 100644
--- a/pkgs/development/interpreters/lua-5/build-lua-package.nix
+++ b/pkgs/development/interpreters/lua-5/build-lua-package.nix
@@ -56,7 +56,7 @@ name ? "${attrs.pname}-${attrs.version}"
 # Appended to the generated luarocks config
 , extraConfig ? ""
 # Inserted into the generated luarocks config in the "variables" table
-, extraVariables ? ""
+, extraVariables ? {}
 # The two above arguments have access to builder variables -- e.g. to $out
 
 # relative to srcRoot, path to the rockspec to use when using rocks
@@ -77,7 +77,10 @@ let
   # luarocks only looks for rockspecs in the default/system tree instead of all
   # configured trees)
   luarocks_config = "luarocks-config.lua";
-  luarocks_content = ''
+  luarocks_content = let
+    extraVariablesStr = lib.concatStringsSep "\n "
+      (lib.mapAttrsToList (k: v: "${k}='${v}';") extraVariables);
+  in ''
     local_cache = ""
     -- To prevent collisions when creating environments, we install the rock
     -- files into per-package subdirectories
@@ -105,8 +108,8 @@ let
       -- Some needed machinery to handle multiple-output external dependencies,
       -- as per https://github.com/luarocks/luarocks/issues/766
       ${lib.optionalString (lib.length depVariables > 0) ''
-      ${lib.concatStringsSep "\n  " depVariables}''}
-      ${extraVariables}
+        ${lib.concatStringsSep "\n  " depVariables}''}
+      ${extraVariablesStr}
     }
     ${extraConfig}
   '';
@@ -139,7 +142,7 @@ let
   externalDeps' = lib.filter (dep: !lib.isDerivation dep) externalDeps;
 in
 toLuaModule ( lua.stdenv.mkDerivation (
-builtins.removeAttrs attrs ["disabled" "checkInputs" "externalDeps"] // {
+builtins.removeAttrs attrs ["disabled" "checkInputs" "externalDeps" "extraVariables"] // {
 
   name = namePrefix + name;
 
@@ -199,8 +202,6 @@ builtins.removeAttrs attrs ["disabled" "checkInputs" "externalDeps"] // {
         LUAROCKS="$LUAROCKS --verbose"
     fi
 
-    patchShebangs .
-
     runHook postBuild
   '';
 
@@ -229,6 +230,13 @@ builtins.removeAttrs attrs ["disabled" "checkInputs" "externalDeps"] // {
     runHook postInstall
   '';
 
+
+  checkPhase = attrs.checkPhase or ''
+    runHook preCheck
+    $LUAROCKS test
+    runHook postCheck
+  '';
+
   passthru = {
     inherit lua; # The lua interpreter
     inherit externalDeps;
diff --git a/pkgs/development/lua-modules/overrides.nix b/pkgs/development/lua-modules/overrides.nix
index fd99a70de3a6..cb429e59c927 100644
--- a/pkgs/development/lua-modules/overrides.nix
+++ b/pkgs/development/lua-modules/overrides.nix
@@ -153,11 +153,11 @@ with super;
   });
 
   luadbi-mysql = super.luadbi-mysql.override({
-    extraVariables = ''
-      -- Can't just be /include and /lib, unfortunately needs the trailing 'mysql'
-      MYSQL_INCDIR='${pkgs.libmysqlclient}/include/mysql';
-      MYSQL_LIBDIR='${pkgs.libmysqlclient}/lib/mysql';
-    '';
+    extraVariables = {
+      # Can't just be /include and /lib, unfortunately needs the trailing 'mysql'
+      MYSQL_INCDIR="${pkgs.libmysqlclient}/include/mysql";
+      MYSQL_LIBDIR="${pkgs.libmysqlclient}/lib/mysql";
+    };
     buildInputs = [
       pkgs.mysql.client
       pkgs.libmysqlclient