Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow to run luarocks test #81067

Merged
merged 3 commits into from
Feb 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions pkgs/development/interpreters/lua-5/build-lua-package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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}
'';
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -199,8 +202,6 @@ builtins.removeAttrs attrs ["disabled" "checkInputs" "externalDeps"] // {
LUAROCKS="$LUAROCKS --verbose"
fi

patchShebangs .

runHook postBuild
'';

Expand Down Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions pkgs/development/lua-modules/overrides.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down