lua: use finalAttrs for interpreters (#264381)

This commit is contained in:
Matthieu Coudron 2023-11-23 10:19:14 +01:00 committed by GitHub
parent 291192ede8
commit 79245fc3e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 25 deletions

View file

@ -1,6 +1,5 @@
{ lib, stdenv, fetchurl, readline
, compat ? false
, callPackage
, makeWrapper
, self
, packageOverrides ? (final: prev: {})
@ -18,12 +17,14 @@
, staticOnly ? stdenv.hostPlatform.isStatic
, luaAttr ? "lua${lib.versions.major version}_${lib.versions.minor version}"
} @ inputs:
let
stdenv.mkDerivation (finalAttrs:
let
luaPackages = self.pkgs;
luaversion = lib.versions.majorMinor version;
plat = if (stdenv.isLinux && lib.versionOlder self.luaversion "5.4") then "linux"
plat = if (stdenv.isLinux && lib.versionOlder self.luaversion "5.4") then "linux"
else if (stdenv.isLinux && lib.versionAtLeast self.luaversion "5.4") then "linux-readline"
else if stdenv.isDarwin then "macosx"
else if stdenv.hostPlatform.isMinGW then "mingw"
@ -33,23 +34,25 @@ plat = if (stdenv.isLinux && lib.versionOlder self.luaversion "5.4") then "linux
else if stdenv.hostPlatform.isUnix then "posix"
else "generic";
compatFlags = if (lib.versionOlder self.luaversion "5.3") then " -DLUA_COMPAT_ALL"
compatFlags = if (lib.versionOlder self.luaversion "5.3") then " -DLUA_COMPAT_ALL"
else if (lib.versionOlder self.luaversion "5.4") then " -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2"
else " -DLUA_COMPAT_5_3";
in
in
stdenv.mkDerivation rec {
{
pname = "lua";
inherit version;
src = fetchurl {
url = "https://www.lua.org/ftp/${pname}-${version}.tar.gz";
url = "https://www.lua.org/ftp/${finalAttrs.pname}-${finalAttrs.version}.tar.gz";
sha256 = hash;
};
LuaPathSearchPaths = luaPackages.luaLib.luaPathList;
LuaCPathSearchPaths = luaPackages.luaLib.luaCPathList;
setupHook = luaPackages.lua-setup-hook LuaPathSearchPaths LuaCPathSearchPaths;
setupHook = luaPackages.lua-setup-hook
finalAttrs.LuaPathSearchPaths
finalAttrs.LuaCPathSearchPaths;
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ readline ];
@ -163,4 +166,4 @@ stdenv.mkDerivation rec {
license = lib.licenses.mit;
platforms = lib.platforms.unix;
};
}
})

View file

@ -1,11 +1,9 @@
{ lib
, stdenv
, fetchFromGitHub
, buildPackages
, version
, src
, extraMeta ? { }
, callPackage
, self
, packageOverrides ? (final: prev: {})
, pkgsBuildBuild