Merge pull request #187934 from Artturin/luasplice1

This commit is contained in:
Artturi 2022-08-31 16:58:55 +03:00 committed by GitHub
commit 8b739f24a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 428 additions and 296 deletions

View File

@ -20,7 +20,7 @@ in
}@attrs:
let
originalLuaDrv = lua51Packages.${luaAttr};
luaDrv = lua51Packages.lib.overrideLuarocks originalLuaDrv (drv: {
luaDrv = lua51Packages.luaLib.overrideLuarocks originalLuaDrv (drv: {
extraConfig = ''
-- to create a flat hierarchy
lua_modules_path = "lua"

View File

@ -116,8 +116,8 @@ let
] ++ lib.optionals (binPath != "") [
"--suffix" "PATH" ":" binPath
] ++ lib.optionals (luaEnv != null) [
"--prefix" "LUA_PATH" ";" (neovim-unwrapped.lua.pkgs.lib.genLuaPathAbsStr luaEnv)
"--prefix" "LUA_CPATH" ";" (neovim-unwrapped.lua.pkgs.lib.genLuaCPathAbsStr luaEnv)
"--prefix" "LUA_PATH" ";" (neovim-unwrapped.lua.pkgs.luaLib.genLuaPathAbsStr luaEnv)
"--prefix" "LUA_CPATH" ";" (neovim-unwrapped.lua.pkgs.luaLib.genLuaCPathAbsStr luaEnv)
];
manifestRc = vimUtils.vimrcContent ({ customRC = ""; }) ;

View File

@ -2,9 +2,10 @@
{ lib
, lua
, wrapLua
, luarocks
# Whether the derivation provides a lua module or not.
, toLuaModule
, luarocksCheckHook
, luaLib
}:
{
@ -12,9 +13,7 @@ pname
, version
# by default prefix `name` e.g. "lua5.2-${name}"
, namePrefix ? if lua.pkgs.isLuaJIT
then lua.name + "-"
else "lua" + lua.luaversion + "-"
, namePrefix ? "${lua.pname}${lua.sourceVersion.major}.${lua.sourceVersion.minor}-"
# Dependencies for building the package
, buildInputs ? []
@ -82,7 +81,7 @@ let
# configured trees)
luarocks_config = "luarocks-config.lua";
luarocks_content = let
generatedConfig = lua.pkgs.lib.generateLuarocksConfig {
generatedConfig = luaLib.generateLuarocksConfig {
externalDeps = externalDeps ++ externalDepsGenerated;
inherit extraVariables;
inherit rocksSubdir;
@ -107,19 +106,19 @@ let
);
externalDeps' = lib.filter (dep: !lib.isDerivation dep) externalDeps;
luarocksDrv = toLuaModule ( lua.stdenv.mkDerivation (
luarocksDrv = luaLib.toLuaModule ( lua.stdenv.mkDerivation (
builtins.removeAttrs attrs ["disabled" "checkInputs" "externalDeps" "extraVariables"] // {
name = namePrefix + pname + "-" + version;
nativeBuildInputs = [
wrapLua
lua.pkgs.luarocks
]
++ buildInputs
++ lib.optionals doCheck ([ luarocksCheckHook ] ++ checkInputs)
++ (map (d: d.dep) externalDeps')
;
luarocks
] ++ lib.optionals doCheck ([ luarocksCheckHook ] ++ checkInputs);
buildInputs = buildInputs
++ (map (d: d.dep) externalDeps');
# propagate lua to active setup-hook in nix-shell
propagatedBuildInputs = propagatedBuildInputs ++ [ lua ];
@ -156,7 +155,7 @@ builtins.removeAttrs attrs ["disabled" "checkInputs" "externalDeps" "extraVariab
nix_debug "Using LUAROCKS_CONFIG=$LUAROCKS_CONFIG"
LUAROCKS=${lua.pkgs.luarocks}/bin/luarocks
LUAROCKS=luarocks
if (( ''${NIX_DEBUG:-0} >= 1 )); then
LUAROCKS="$LUAROCKS --verbose"
fi

View File

@ -1,11 +1,86 @@
# similar to interpreters/python/default.nix
{ stdenv, lib, callPackage, fetchurl, fetchpatch, makeBinaryWrapper }:
let
# Common passthru for all lua interpreters.
# copied from python
passthruFun =
{ executable
, sourceVersion
, luaversion
, packageOverrides
, luaOnBuildForBuild
, luaOnBuildForHost
, luaOnBuildForTarget
, luaOnHostForHost
, luaOnTargetForTarget
, luaAttr ? null
, self # is luaOnHostForTarget
}: let
luaPackages = callPackage
# Function that when called
# - imports lua-packages.nix
# - adds spliced package sets to the package set
# - applies overrides from `packageOverrides`
({ lua, overrides, callPackage, splicePackages, newScope }: let
luaPackagesFun = callPackage ../../../top-level/lua-packages.nix {
lua = self;
};
generatedPackages = if (builtins.pathExists ../../lua-modules/generated-packages.nix) then
(final: prev: callPackage ../../lua-modules/generated-packages.nix { inherit (final) callPackage; } final prev)
else (final: prev: {});
overridenPackages = callPackage ../../lua-modules/overrides.nix { };
otherSplices = {
selfBuildBuild = luaOnBuildForBuild.pkgs;
selfBuildHost = luaOnBuildForHost.pkgs;
selfBuildTarget = luaOnBuildForTarget.pkgs;
selfHostHost = luaOnHostForHost.pkgs;
selfTargetTarget = luaOnTargetForTarget.pkgs or {};
};
keep = self: { };
extra = spliced0: {};
extensions = lib.composeManyExtensions [
generatedPackages
overridenPackages
overrides
];
in lib.makeScopeWithSplicing
splicePackages
newScope
otherSplices
keep
extra
(lib.extends extensions luaPackagesFun))
{
overrides = packageOverrides;
lua = self;
};
in rec {
buildEnv = callPackage ./wrapper.nix {
lua = self;
inherit (luaPackages) requiredLuaModules;
};
withPackages = import ./with-packages.nix { inherit buildEnv luaPackages;};
pkgs = luaPackages;
interpreter = "${self}/bin/${executable}";
inherit executable luaversion sourceVersion;
luaOnBuild = luaOnBuildForHost.override { inherit packageOverrides; self = luaOnBuild; };
inherit luaAttr;
};
in
rec {
lua5_4 = callPackage ./interpreter.nix {
self = lua5_4;
sourceVersion = { major = "5"; minor = "4"; patch = "3"; };
hash = "1yxvjvnbg4nyrdv10bq42gz6dr66pyan28lgzfygqfwy2rv24qgq";
makeWrapper = makeBinaryWrapper;
inherit passthruFun;
patches = lib.optional stdenv.isDarwin ./5.4.darwin.patch
++ [
@ -28,53 +103,62 @@ rec {
};
lua5_4_compat = lua5_4.override({
self = lua5_4_compat;
compat = true;
});
lua5_3 = callPackage ./interpreter.nix {
self = lua5_3;
sourceVersion = { major = "5"; minor = "3"; patch = "6"; };
hash = "0q3d8qhd7p0b7a4mh9g7fxqksqfs6mr1nav74vq26qvkp2dxcpzw";
makeWrapper = makeBinaryWrapper;
inherit passthruFun;
patches =
lib.optionals stdenv.isDarwin [ ./5.2.darwin.patch ];
};
lua5_3_compat = lua5_3.override({
self = lua5_3_compat;
compat = true;
});
lua5_2 = callPackage ./interpreter.nix {
self = lua5_2;
sourceVersion = { major = "5"; minor = "2"; patch = "4"; };
hash = "0jwznq0l8qg9wh5grwg07b5cy3lzngvl5m2nl1ikp6vqssmf9qmr";
makeWrapper = makeBinaryWrapper;
inherit passthruFun;
patches = [
./CVE-2022-28805.patch
] ++ lib.optional stdenv.isDarwin ./5.2.darwin.patch;
};
lua5_2_compat = lua5_2.override({
self = lua5_2_compat;
compat = true;
});
lua5_1 = callPackage ./interpreter.nix {
self = lua5_1;
sourceVersion = { major = "5"; minor = "1"; patch = "5"; };
hash = "2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333";
makeWrapper = makeBinaryWrapper;
inherit passthruFun;
patches = (lib.optional stdenv.isDarwin ./5.1.darwin.patch)
++ [ ./CVE-2014-5461.patch ];
};
luajit_2_0 = import ../luajit/2.0.nix {
self = luajit_2_0;
inherit callPackage lib;
inherit callPackage lib passthruFun;
};
luajit_2_1 = import ../luajit/2.1.nix {
self = luajit_2_1;
inherit callPackage;
inherit callPackage passthruFun;
};
}

View File

@ -2,19 +2,26 @@
, compat ? false
, callPackage
, makeWrapper
, self
, packageOverrides ? (final: prev: {})
, pkgsBuildBuild
, pkgsBuildHost
, pkgsBuildTarget
, pkgsHostHost
, pkgsTargetTarget
, sourceVersion
, hash
, passthruFun
, patches ? []
, postConfigure ? null
, postBuild ? null
, staticOnly ? stdenv.hostPlatform.isStatic
}:
, luaAttr ? "lua${sourceVersion.major}_${sourceVersion.minor}"
} @ inputs:
let
luaPackages = callPackage ../../lua-modules {
lua = self;
overrides = packageOverrides;
};
luaPackages = self.pkgs;
luaversion = with sourceVersion; "${major}.${minor}";
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"
@ -25,10 +32,10 @@ plat = if (stdenv.isLinux && lib.versionOlder self.luaversion "5.4") then "linux
else if stdenv.hostPlatform.isBSD then "bsd"
else if stdenv.hostPlatform.isUnix then "posix"
else "generic";
in
self = stdenv.mkDerivation rec {
stdenv.mkDerivation rec {
pname = "lua";
luaversion = with sourceVersion; "${major}.${minor}";
version = "${luaversion}.${sourceVersion.patch}";
src = fetchurl {
@ -36,8 +43,8 @@ self = stdenv.mkDerivation rec {
sha256 = hash;
};
LuaPathSearchPaths = luaPackages.lib.luaPathList;
LuaCPathSearchPaths = luaPackages.lib.luaCPathList;
LuaPathSearchPaths = luaPackages.luaLib.luaPathList;
LuaCPathSearchPaths = luaPackages.luaLib.luaCPathList;
setupHook = luaPackages.lua-setup-hook LuaPathSearchPaths LuaCPathSearchPaths;
nativeBuildInputs = [ makeWrapper ];
@ -123,15 +130,19 @@ self = stdenv.mkDerivation rec {
ln -s "$out/lib/pkgconfig/lua.pc" "$out/lib/pkgconfig/lua${lib.replaceStrings [ "." ] [ "" ] luaversion}.pc"
'';
passthru = rec {
buildEnv = callPackage ./wrapper.nix {
lua = self;
inherit makeWrapper;
inherit (luaPackages) requiredLuaModules;
};
withPackages = import ./with-packages.nix { inherit buildEnv luaPackages;};
pkgs = luaPackages;
interpreter = "${self}/bin/lua";
# copied from python
passthru = let
# When we override the interpreter we also need to override the spliced versions of the interpreter
inputs' = lib.filterAttrs (n: v: ! lib.isDerivation v && n != "passthruFun") inputs;
override = attr: let lua = attr.override (inputs' // { self = lua; }); in lua;
in passthruFun rec {
inherit self luaversion packageOverrides luaAttr sourceVersion;
executable = "lua";
luaOnBuildForBuild = override pkgsBuildBuild.${luaAttr};
luaOnBuildForHost = override pkgsBuildHost.${luaAttr};
luaOnBuildForTarget = override pkgsBuildTarget.${luaAttr};
luaOnHostForHost = override pkgsHostHost.${luaAttr};
luaOnTargetForTarget = if lib.hasAttr luaAttr pkgsTargetTarget then (override pkgsTargetTarget.${luaAttr}) else {};
};
meta = {
@ -148,5 +159,4 @@ self = stdenv.mkDerivation rec {
license = lib.licenses.mit;
platforms = lib.platforms.unix;
};
};
in self
}

View File

@ -1,6 +1,7 @@
{ self, callPackage, lib }:
{ self, callPackage, lib, passthruFun }:
callPackage ./default.nix {
inherit self;
sourceVersion = { major = "2"; minor = "0"; patch = "5"; };
inherit self passthruFun;
version = "2.0.5-2022-03-13";
rev = "93a65d3cc263aef2d2feb3d7ff2206aca3bee17e";
isStable = true;

View File

@ -1,6 +1,7 @@
{ self, callPackage }:
{ self, callPackage, passthruFun }:
callPackage ./default.nix {
inherit self;
sourceVersion = { major = "2"; minor = "1"; patch = "0"; };
inherit self passthruFun;
version = "2.1.0-2022-04-05";
rev = "5e3c45c43bb0e0f1f2917d432e9d2dba12c42a6e";
isStable = false;

View File

@ -2,7 +2,6 @@
, stdenv
, fetchFromGitHub
, buildPackages
, name ? "luajit-${version}"
, isStable
, hash
, rev
@ -11,6 +10,13 @@
, callPackage
, self
, packageOverrides ? (final: prev: {})
, pkgsBuildBuild
, pkgsBuildHost
, pkgsBuildTarget
, pkgsHostHost
, pkgsTargetTarget
, sourceVersion
, passthruFun
, enableFFI ? true
, enableJIT ? true
, enableJITDebugModule ? enableJIT
@ -22,12 +28,14 @@
, enableAPICheck ? false
, enableVMAssertions ? false
, useSystemMalloc ? false
}:
, luaAttr ? "luajit_${sourceVersion.major}_${sourceVersion.minor}"
} @ inputs:
assert enableJITDebugModule -> enableJIT;
assert enableGDBJITSupport -> enableJIT;
assert enableValgrindSupport -> valgrind != null;
let
luaPackages = callPackage ../../lua-modules { lua = self; overrides = packageOverrides; };
luaPackages = self.pkgs;
XCFLAGS = with lib;
optional (!enableFFI) "-DLUAJIT_DISABLE_FFI"
@ -42,7 +50,8 @@ let
;
in
stdenv.mkDerivation rec {
inherit name version;
pname = "luajit";
inherit version;
src = fetchFromGitHub {
owner = "LuaJIT";
repo = "LuaJIT";
@ -93,19 +102,24 @@ stdenv.mkDerivation rec {
ln -s "$out"/bin/luajit-* "$out"/bin/luajit
'';
LuaPathSearchPaths = luaPackages.lib.luaPathList;
LuaCPathSearchPaths = luaPackages.lib.luaCPathList;
LuaPathSearchPaths = luaPackages.luaLib.luaPathList;
LuaCPathSearchPaths = luaPackages.luaLib.luaCPathList;
setupHook = luaPackages.lua-setup-hook luaPackages.lib.luaPathList luaPackages.lib.luaCPathList;
setupHook = luaPackages.lua-setup-hook luaPackages.luaLib.luaPathList luaPackages.luaLib.luaCPathList;
passthru = rec {
buildEnv = callPackage ../lua-5/wrapper.nix {
lua = self;
inherit (luaPackages) requiredLuaModules;
};
withPackages = import ../lua-5/with-packages.nix { inherit buildEnv luaPackages; };
pkgs = luaPackages;
interpreter = "${self}/bin/lua";
# copied from python
passthru = let
# When we override the interpreter we also need to override the spliced versions of the interpreter
inputs' = lib.filterAttrs (n: v: ! lib.isDerivation v && n != "passthruFun") inputs;
override = attr: let lua = attr.override (inputs' // { self = lua; }); in lua;
in passthruFun rec {
inherit self luaversion packageOverrides luaAttr sourceVersion;
executable = "lua";
luaOnBuildForBuild = override pkgsBuildBuild.${luaAttr};
luaOnBuildForHost = override pkgsBuildHost.${luaAttr};
luaOnBuildForTarget = override pkgsBuildTarget.${luaAttr};
luaOnHostForHost = override pkgsHostHost.${luaAttr};
luaOnTargetForTarget = if lib.hasAttr luaAttr pkgsTargetTarget then (override pkgsTargetTarget.${luaAttr}) else {};
};
meta = with lib; {

View File

@ -10,9 +10,7 @@ stdenv.mkDerivation rec {
sha256 = "0rai5djdkjz7bsn025k5489in7r1amagw1pib0z4qns6b52kiar2";
};
nativeBuildInputs = [ libtool ];
makeFlags = [ "LIBTOOL=libtool" "PREFIX=$(out)" ];
makeFlags = [ "LIBTOOL=${libtool}/bin/libtool" "PREFIX=$(out)" ];
meta = with lib; {
description = "Simple implementation of msgpack in C";

View File

@ -1,29 +0,0 @@
# inspired by pkgs/development/haskell-modules/default.nix
{ pkgs, lib
, lua
, overrides ? (final: prev: {})
}:
let
inherit (lib) extends;
initialPackages = (pkgs.callPackage ../../top-level/lua-packages.nix {
inherit lua;
});
overridenPackages = import ./overrides.nix { inherit pkgs; };
generatedPackages = if (builtins.pathExists ./generated-packages.nix) then
(final: prev: pkgs.callPackage ./generated-packages.nix { inherit (final) callPackage; } final prev) else (final: prev: {});
extensible-self = lib.makeExtensible
(extends overrides
(extends overridenPackages
(extends generatedPackages
initialPackages
)
)
);
in
extensible-self

View File

@ -1,4 +1,4 @@
{ fetchFromGitHub, buildLuarocksPackage, lua, maintainers, pkg-config
{ fetchFromGitHub, buildLuarocksPackage, lua, pkg-config, lib
, substituteAll, zenity }:
buildLuarocksPackage {
@ -35,7 +35,7 @@ buildLuarocksPackage {
description =
"A tiny, neat lua library that portably invokes native file open and save dialogs.";
homepage = "https://github.com/Alloyed/nativefiledialog/tree/master/lua";
license.fullName = "zlib";
maintainers = [ maintainers.scoder12 ];
license = lib.licenses.zlib;
maintainers = [ lib.maintainers.scoder12 ];
};
}

View File

@ -1,4 +1,45 @@
{ pkgs }:
# do not add pkgs, it messes up splicing
{ stdenv
, cmake
, cyrus_sasl
, dbus
, expat
, fetchFromGitHub
, fetchpatch
, fetchurl
, fixDarwinDylibNames
, glib
, glibc
, gmp
, gnulib
, gnum4
, gobject-introspection
, installShellFiles
, lib
, libevent
, libiconv
, libmpack
, libmysqlclient
, libuuid
, libuv
, libyaml
, mariadb
, mpfr
, neovim-unwrapped
, openssl_1_1
, pcre
, pkg-config
, postgresql
, readline
, sqlite
, unbound
, vimPlugins
, vimUtils
, yajl
, zlib
, zziplib
}:
final: prev:
with prev;
{
@ -16,7 +57,7 @@ with prev;
busted = prev.busted.overrideAttrs (oa: {
nativeBuildInputs = oa.nativeBuildInputs ++ [
pkgs.installShellFiles
installShellFiles
];
postConfigure = ''
substituteInPlace ''${rockspecFilename} \
@ -29,28 +70,30 @@ with prev;
'';
});
cqueues = (prev.lib.overrideLuarocks prev.cqueues (drv: {
cqueues = (prev.luaLib.overrideLuarocks prev.cqueues (drv: {
externalDeps = [
{ name = "CRYPTO"; dep = pkgs.openssl_1_1; }
{ name = "OPENSSL"; dep = pkgs.openssl_1_1; }
{ name = "CRYPTO"; dep = openssl_1_1; }
{ name = "OPENSSL"; dep = openssl_1_1; }
];
disabled = luaOlder "5.1" || luaAtLeast "5.4";
})).overrideAttrs (oa: rec {
# Parse out a version number without the Lua version inserted
version = with pkgs.lib; let
version = with lib; let
version' = prev.cqueues.version;
rel = splitVersion version';
date = head rel;
rev = last (splitString "-" (last rel));
in "${date}-${rev}";
in
"${date}-${rev}";
nativeBuildInputs = oa.nativeBuildInputs ++ [
pkgs.gnum4
gnum4
];
# Upstream rockspec is pointlessly broken into separate rockspecs, per Lua
# version, which doesn't work well for us, so modify it
postConfigure = let inherit (prev.cqueues) pname; in ''
postConfigure = let inherit (prev.cqueues) pname; in
''
# 'all' target auto-detects correct Lua version, which is fine for us as
# we only have the right one available :)
sed -Ei ''${rockspecFilename} \
@ -63,15 +106,15 @@ with prev;
'';
});
cyrussasl = prev.lib.overrideLuarocks prev.cyrussasl (drv: {
cyrussasl = prev.luaLib.overrideLuarocks prev.cyrussasl (drv: {
externalDeps = [
{ name = "LIBSASL"; dep = pkgs.cyrus_sasl; }
{ name = "LIBSASL"; dep = cyrus_sasl; }
];
});
http = prev.http.overrideAttrs (oa: {
patches = [
(pkgs.fetchpatch {
(fetchpatch {
name = "invalid-state-progression.patch";
url = "https://github.com/daurnimator/lua-http/commit/cb7b59474a.diff";
sha256 = "1vmx039n3nqfx50faqhs3wgiw28ws416rhw6vh6srmh9i826dac7";
@ -83,21 +126,21 @@ with prev;
*/
});
ldbus = prev.lib.overrideLuarocks prev.ldbus (drv: {
ldbus = prev.luaLib.overrideLuarocks prev.ldbus (drv: {
extraVariables = {
DBUS_DIR="${pkgs.dbus.lib}";
DBUS_ARCH_INCDIR="${pkgs.dbus.lib}/lib/dbus-1.0/include";
DBUS_INCDIR="${pkgs.dbus.dev}/include/dbus-1.0";
DBUS_DIR = "${dbus.lib}";
DBUS_ARCH_INCDIR = "${dbus.lib}/lib/dbus-1.0/include";
DBUS_INCDIR = "${dbus.dev}/include/dbus-1.0";
};
buildInputs = with pkgs; [
buildInputs = [
dbus
];
});
ljsyscall = prev.lib.overrideLuarocks prev.ljsyscall (drv: rec {
ljsyscall = prev.luaLib.overrideLuarocks prev.ljsyscall (drv: rec {
version = "unstable-20180515";
# package hasn't seen any release for a long time
src = pkgs.fetchFromGitHub {
src = fetchFromGitHub {
owner = "justincormack";
repo = "ljsyscall";
rev = "e587f8c55aad3955dddab3a4fa6c1968037b5c6e";
@ -110,50 +153,56 @@ with prev;
'';
disabled = luaOlder "5.1" || luaAtLeast "5.3";
propagatedBuildInputs = with pkgs.lib; optional (!isLuaJIT) luaffi;
propagatedBuildInputs = with lib; optional (!isLuaJIT) luaffi;
});
lgi = prev.lgi.overrideAttrs (oa: {
nativeBuildInputs = oa.nativeBuildInputs ++ [
pkgs.pkg-config
pkg-config
];
buildInputs = [
pkgs.glib
pkgs.gobject-introspection
glib
gobject-introspection
];
patches = [
(pkgs.fetchpatch {
(fetchpatch {
name = "lgi-find-cairo-through-typelib.patch";
url = "https://github.com/psychon/lgi/commit/46a163d9925e7877faf8a4f73996a20d7cf9202a.patch";
sha256 = "0gfvvbri9kyzhvq3bvdbj2l6mwvlz040dk4mrd5m9gz79f7w109c";
})
];
# https://github.com/lgi-devs/lgi/pull/300
postPatch = ''
substituteInPlace lgi/Makefile tests/Makefile \
--replace 'PKG_CONFIG =' 'PKG_CONFIG ?='
'';
# there is only a rockspec.in in the repo, the actual rockspec must be generated
preConfigure = ''
make rock
'';
});
lmathx = prev.lib.overrideLuarocks prev.lmathx (drv:
lmathx = prev.luaLib.overrideLuarocks prev.lmathx (drv:
if luaAtLeast "5.1" && luaOlder "5.2" then {
version = "20120430.51-1";
knownRockspec = (pkgs.fetchurl {
knownRockspec = (fetchurl {
url = "https://luarocks.org/lmathx-20120430.51-1.rockspec";
sha256 = "148vbv2g3z5si2db7rqg5bdily7m4sjyh9w6r3jnx3csvfaxyhp0";
}).outPath;
src = pkgs.fetchurl {
src = fetchurl {
url = "https://web.tecgraf.puc-rio.br/~lhf/ftp/lua/5.1/lmathx.tar.gz";
sha256 = "0sa553d0zlxhvpsmr4r7d841f16yq4wr3fg7i07ibxkz6yzxax51";
};
} else
if luaAtLeast "5.2" && luaOlder "5.3" then {
version = "20120430.52-1";
knownRockspec = (pkgs.fetchurl {
knownRockspec = (fetchurl {
url = "https://luarocks.org/lmathx-20120430.52-1.rockspec";
sha256 = "14rd625sipakm72wg6xqsbbglaxyjba9nsajsfyvhg0sz8qjgdya";
}).outPath;
src = pkgs.fetchurl {
src = fetchurl {
url = "http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/5.2/lmathx.tar.gz";
sha256 = "19dwa4z266l2njgi6fbq9rak4rmx2fsx1s0p9sl166ar3mnrdwz5";
};
@ -167,37 +216,37 @@ with prev;
'';
});
lmpfrlib = prev.lib.overrideLuarocks prev.lmpfrlib (drv: {
lmpfrlib = prev.luaLib.overrideLuarocks prev.lmpfrlib (drv: {
externalDeps = [
{ name = "GMP"; dep = pkgs.gmp; }
{ name = "MPFR"; dep = pkgs.mpfr; }
{ name = "GMP"; dep = gmp; }
{ name = "MPFR"; dep = mpfr; }
];
unpackPhase = ''
cp $src $(stripHash $src)
'';
});
lrexlib-gnu = prev.lib.overrideLuarocks prev.lrexlib-gnu (drv: {
lrexlib-gnu = prev.luaLib.overrideLuarocks prev.lrexlib-gnu (drv: {
buildInputs = [
pkgs.gnulib
gnulib
];
});
lrexlib-pcre = prev.lib.overrideLuarocks prev.lrexlib-pcre (drv: {
lrexlib-pcre = prev.luaLib.overrideLuarocks prev.lrexlib-pcre (drv: {
externalDeps = [
{ name = "PCRE"; dep = pkgs.pcre; }
{ name = "PCRE"; dep = pcre; }
];
});
lrexlib-posix = prev.lib.overrideLuarocks prev.lrexlib-posix (drv: {
lrexlib-posix = prev.luaLib.overrideLuarocks prev.lrexlib-posix (drv: {
buildInputs = [
pkgs.glibc.dev
glibc.dev
];
});
lua-iconv = prev.lib.overrideLuarocks prev.lua-iconv (drv: {
lua-iconv = prev.luaLib.overrideLuarocks prev.lua-iconv (drv: {
buildInputs = [
pkgs.libiconv
libiconv
];
});
@ -209,59 +258,60 @@ with prev;
'';
});
lua-zlib = prev.lib.overrideLuarocks prev.lua-zlib (drv: {
lua-zlib = prev.luaLib.overrideLuarocks prev.lua-zlib (drv: {
buildInputs = [
pkgs.zlib.dev
zlib.dev
];
disabled = luaOlder "5.1" || luaAtLeast "5.4";
});
luadbi-mysql = prev.lib.overrideLuarocks prev.luadbi-mysql (drv: {
luadbi-mysql = prev.luaLib.overrideLuarocks prev.luadbi-mysql (drv: {
extraVariables = {
# Can't just be /include and /lib, unfortunately needs the trailing 'mysql'
MYSQL_INCDIR="${pkgs.libmysqlclient.dev}/include/mysql";
MYSQL_LIBDIR="${pkgs.libmysqlclient}/lib/mysql";
MYSQL_INCDIR = "${libmysqlclient.dev}/include/mysql";
MYSQL_LIBDIR = "${libmysqlclient}/lib/mysql";
};
buildInputs = [
pkgs.mariadb.client
pkgs.libmysqlclient
mariadb.client
libmysqlclient
];
});
luadbi-postgresql = prev.lib.overrideLuarocks prev.luadbi-postgresql (drv: {
luadbi-postgresql = prev.luaLib.overrideLuarocks prev.luadbi-postgresql (drv: {
buildInputs = [
pkgs.postgresql
postgresql
];
});
luadbi-sqlite3 = prev.lib.overrideLuarocks prev.luadbi-sqlite3 (drv: {
luadbi-sqlite3 = prev.luaLib.overrideLuarocks prev.luadbi-sqlite3 (drv: {
externalDeps = [
{ name = "SQLITE"; dep = pkgs.sqlite; }
{ name = "SQLITE"; dep = sqlite; }
];
});
luaevent = prev.lib.overrideLuarocks prev.luaevent (drv: {
luaevent = prev.luaLib.overrideLuarocks prev.luaevent (drv: {
propagatedBuildInputs = [
luasocket
];
externalDeps = [
{ name = "EVENT"; dep = pkgs.libevent; }
{ name = "EVENT"; dep = libevent; }
];
disabled = luaOlder "5.1" || luaAtLeast "5.4";
});
luaexpat = prev.lib.overrideLuarocks prev.luaexpat (drv: {
luaexpat = prev.luaLib.overrideLuarocks prev.luaexpat (drv: {
externalDeps = [
{ name = "EXPAT"; dep = pkgs.expat; }
{ name = "EXPAT"; dep = expat; }
];
});
# TODO Somehow automatically amend buildInputs for things that need luaffi
# but are in luajitPackages?
luaffi = prev.lib.overrideLuarocks prev.luaffi (drv: {
luaffi = prev.luaLib.overrideLuarocks prev.luaffi (drv: {
# The packaged .src.rock version is pretty old, and doesn't work with Lua 5.3
src = pkgs.fetchFromGitHub {
owner = "facebook"; repo = "luaffifb";
src = fetchFromGitHub {
owner = "facebook";
repo = "luaffifb";
rev = "532c757e51c86f546a85730b71c9fef15ffa633d";
sha256 = "1nwx6sh56zfq99rcs7sph0296jf6a9z72mxknn0ysw9fd7m1r8ig";
};
@ -269,56 +319,56 @@ with prev;
disabled = luaOlder "5.1" || luaAtLeast "5.4" || isLuaJIT;
});
luaossl = prev.lib.overrideLuarocks prev.luaossl (drv: {
luaossl = prev.luaLib.overrideLuarocks prev.luaossl (drv: {
externalDeps = [
# https://github.com/wahern/luaossl/pull/199
{ name = "CRYPTO"; dep = pkgs.openssl_1_1; }
{ name = "OPENSSL"; dep = pkgs.openssl_1_1; }
{ name = "CRYPTO"; dep = openssl_1_1; }
{ name = "OPENSSL"; dep = openssl_1_1; }
];
});
luasec = prev.lib.overrideLuarocks prev.luasec (drv: {
luasec = prev.luaLib.overrideLuarocks prev.luasec (drv: {
externalDeps = [
{ name = "OPENSSL"; dep = pkgs.openssl_1_1; }
{ name = "OPENSSL"; dep = openssl_1_1; }
];
});
luasql-sqlite3 = prev.lib.overrideLuarocks prev.luasql-sqlite3 (drv: {
luasql-sqlite3 = prev.luaLib.overrideLuarocks prev.luasql-sqlite3 (drv: {
externalDeps = [
{ name = "SQLITE"; dep = pkgs.sqlite; }
{ name = "SQLITE"; dep = sqlite; }
];
});
luasystem = prev.lib.overrideLuarocks prev.luasystem (drv: pkgs.lib.optionalAttrs pkgs.stdenv.isLinux {
buildInputs = [ pkgs.glibc.out ];
luasystem = prev.luaLib.overrideLuarocks prev.luasystem (drv: lib.optionalAttrs stdenv.isLinux {
buildInputs = [ glibc.out ];
});
luazip = prev.lib.overrideLuarocks prev.luazip (drv: {
luazip = prev.luaLib.overrideLuarocks prev.luazip (drv: {
buildInputs = [
pkgs.zziplib
zziplib
];
});
lua-yajl = prev.lib.overrideLuarocks prev.lua-yajl (drv: {
lua-yajl = prev.luaLib.overrideLuarocks prev.lua-yajl (drv: {
buildInputs = [
pkgs.yajl
yajl
];
});
luaunbound = prev.lib.overrideLuarocks prev.luaunbound(drv: {
luaunbound = prev.luaLib.overrideLuarocks prev.luaunbound (drv: {
externalDeps = [
{ name = "libunbound"; dep = pkgs.unbound; }
{ name = "libunbound"; dep = unbound; }
];
});
luuid = (prev.lib.overrideLuarocks prev.luuid (drv: {
luuid = (prev.luaLib.overrideLuarocks prev.luuid (drv: {
externalDeps = [
{ name = "LIBUUID"; dep = pkgs.libuuid; }
{ name = "LIBUUID"; dep = libuuid; }
];
disabled = luaOlder "5.1" || (luaAtLeast "5.4");
})).overrideAttrs (oa: {
meta = oa.meta // {
platforms = pkgs.lib.platforms.linux;
platforms = lib.platforms.linux;
};
# Trivial patch to make it work in both 5.1 and 5.2. Basically just the
# tiny diff between the two upstream versions placed behind an #if.
@ -329,7 +379,8 @@ with prev;
patches = [
./luuid.patch
];
postConfigure = let inherit (prev.luuid) version pname; in ''
postConfigure = let inherit (prev.luuid) version pname; in
''
sed -Ei ''${rockspecFilename} -e 's|lua >= 5.2|lua >= 5.1,|'
'';
});
@ -337,7 +388,7 @@ with prev;
# as advised in https://github.com/luarocks/luarocks/issues/1402#issuecomment-1080616570
# we shouldn't use luarocks machinery to build complex cmake components
libluv = pkgs.stdenv.mkDerivation {
libluv = stdenv.mkDerivation {
pname = "libluv";
inherit (prev.luv) version meta src;
@ -355,15 +406,15 @@ with prev;
rm -rf deps/lua deps/libuv
'';
buildInputs = [ pkgs.libuv final.lua ];
buildInputs = [ libuv final.lua ];
nativeBuildInputs = [ pkgs.pkg-config pkgs.cmake ]
++ pkgs.lib.optionals pkgs.stdenv.isDarwin [ pkgs.fixDarwinDylibNames ];
nativeBuildInputs = [ pkg-config cmake ]
++ lib.optionals stdenv.isDarwin [ fixDarwinDylibNames ];
};
luv = prev.lib.overrideLuarocks prev.luv (drv: {
luv = prev.luaLib.overrideLuarocks prev.luv (drv: {
buildInputs = [ pkgs.pkg-config pkgs.libuv ];
buildInputs = [ pkg-config libuv ];
# Use system libuv instead of building local and statically linking
extraVariables = {
@ -381,14 +432,14 @@ with prev;
});
lyaml = prev.lib.overrideLuarocks prev.lyaml (oa: {
lyaml = prev.luaLib.overrideLuarocks prev.lyaml (oa: {
buildInputs = [
pkgs.libyaml
libyaml
];
});
mpack = prev.lib.overrideLuarocks prev.mpack (drv: {
buildInputs = [ pkgs.libmpack ];
mpack = prev.luaLib.overrideLuarocks prev.mpack (drv: {
buildInputs = [ libmpack ];
# the rockspec doesn't use the makefile so you may need to export more flags
USE_SYSTEM_LUA = "yes";
USE_SYSTEM_MPACK = "yes";
@ -401,35 +452,35 @@ with prev;
'';
});
readline = (prev.lib.overrideLuarocks prev.readline (drv: {
readline = (prev.luaLib.overrideLuarocks prev.readline (drv: {
unpackCmd = ''
unzip "$curSrc"
tar xf *.tar.gz
'';
propagatedBuildInputs = prev.readline.propagatedBuildInputs ++ [ pkgs.readline.out ];
propagatedBuildInputs = prev.readline.propagatedBuildInputs ++ [ readline.out ];
extraVariables = rec {
READLINE_INCDIR = "${pkgs.readline.dev}/include";
READLINE_INCDIR = "${readline.dev}/include";
HISTORY_INCDIR = READLINE_INCDIR;
};
})).overrideAttrs (old: {
# Without this, source root is wrongly set to ./readline-2.6/doc
setSourceRoot = ''
sourceRoot=./readline-${pkgs.lib.versions.majorMinor old.version}
sourceRoot=./readline-${lib.versions.majorMinor old.version}
'';
});
sqlite = prev.lib.overrideLuarocks prev.sqlite (drv: {
sqlite = prev.luaLib.overrideLuarocks prev.sqlite (drv: {
doCheck = true;
checkInputs = [ final.plenary-nvim pkgs.neovim-unwrapped ];
checkInputs = [ final.plenary-nvim neovim-unwrapped ];
# we override 'luarocks test' because otherwise neovim doesn't find/load the plenary plugin
checkPhase = ''
export LIBSQLITE="${pkgs.sqlite.out}/lib/libsqlite3.so"
export LIBSQLITE="${sqlite.out}/lib/libsqlite3.so"
export HOME="$TMPDIR";
nvim --headless -i NONE \
-u test/minimal_init.vim --cmd "set rtp+=${pkgs.vimPlugins.plenary-nvim}" \
-u test/minimal_init.vim --cmd "set rtp+=${vimPlugins.plenary-nvim}" \
-c "PlenaryBustedDirectory test/auto/ { minimal_init = './test/minimal_init.vim' }"
'';
@ -452,7 +503,7 @@ with prev;
# TODO just while testing, remove afterwards
# toVimPlugin should do it instead
gitsigns-nvim = prev.gitsigns-nvim.overrideAttrs (oa: {
nativeBuildInputs = oa.nativeBuildInputs or [] ++ [ pkgs.vimUtils.vimGenDocHook ];
nativeBuildInputs = oa.nativeBuildInputs or [ ] ++ [ vimUtils.vimGenDocHook ];
});
# aliases

View File

@ -1,4 +1,5 @@
{lib, stdenv, fetchFromGitHub
{lib, stdenv, fetchFromGitHub, buildPackages
, fetchpatch
, curl, makeWrapper, which, unzip
, lua
# for 'luarocks pack'
@ -20,7 +21,15 @@ stdenv.mkDerivation rec {
sha256 = "sha256-i0NmF268aK5lr4zjYyhk4TPUO7Zyz0Cl0fSW43Pmd1Q=";
};
patches = [ ./darwin-3.7.0.patch ];
patches = [
./darwin-3.7.0.patch
# follow standard environmental variables
# https://github.com/luarocks/luarocks/pull/1433
(fetchpatch {
url = "https://github.com/luarocks/luarocks/commit/d719541577a89909185aa8de7a33cf73b7a63ac3.diff";
sha256 = "sha256-rMnhZFqLEul0wnsxvw9nl6JXVanC5QgOZ+I/HJ0vRCM=";
})
];
postPatch = lib.optionalString stdenv.targetPlatform.isDarwin ''
substituteInPlace src/luarocks/core/cfg.lua --subst-var-by 'darwinMinVersion' '${stdenv.targetPlatform.darwinMinVersion}'
@ -43,12 +52,15 @@ stdenv.mkDerivation rec {
fi
'';
nativeBuildInputs = [ makeWrapper installShellFiles ];
nativeBuildInputs = [ makeWrapper installShellFiles lua unzip ];
buildInputs = [ lua curl which ];
buildInputs = [ curl which ];
postInstall = ''
sed -e "1s@.*@#! ${lua}/bin/lua$LUA_SUFFIX@" -i "$out"/bin/*
substituteInPlace $out/etc/luarocks/* \
--replace '${lua.luaOnBuild}' '${lua}'
for i in "$out"/bin/*; do
test -L "$i" || {
wrapProgram "$i" \
@ -58,7 +70,7 @@ stdenv.mkDerivation rec {
--suffix LUA_CPATH ";" "$(echo "$out"/share/lua/*/)?/init.lua"
}
done
'' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd luarocks --bash <($out/bin/luarocks completion bash)
installShellCompletion --cmd luarocks --zsh <($out/bin/luarocks completion zsh)
'';
@ -76,6 +88,10 @@ stdenv.mkDerivation rec {
export LUA_PATH="src/?.lua;''${LUA_PATH:-}"
'';
disallowedReferences = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
lua.luaOnBuild
];
passthru = {
updateScript = nix-update-script {
attrPath = pname;

View File

@ -37,8 +37,8 @@ stdenv.mkDerivation rec {
cp openrussian $out/bin
wrapProgram $out/bin/openrussian \
--prefix LUA_PATH ';' '${lua.pkgs.lib.genLuaPathAbsStr luaEnv}' \
--prefix LUA_CPATH ';' '${lua.pkgs.lib.genLuaCPathAbsStr luaEnv}'
--prefix LUA_PATH ';' '${lua.pkgs.luaLib.genLuaPathAbsStr luaEnv}' \
--prefix LUA_CPATH ';' '${lua.pkgs.luaLib.genLuaCPathAbsStr luaEnv}'
runHook postInstall
'';

View File

@ -50,6 +50,6 @@ stdenv.mkDerivation rec {
description = "Named Data Neworking (NDN) Forwarding Daemon";
license = licenses.gpl3Plus;
platforms = platforms.unix;
maintainers = [ maintainers.bertof ];
maintainers = [ lib.maintainers.bertof ];
};
}

View File

@ -5,72 +5,61 @@
for each package in a separate file: the call to the function would
be almost as must code as the function itself. */
{ fetchurl, stdenv, lua, unzip, pkg-config
, pcre, oniguruma, gnulib, tre, glibc, sqlite, openssl, expat
, autoreconfHook, gnum4
, postgresql, cyrus_sasl
, fetchFromGitHub, which, writeText
, pkgs
{ pkgs
, stdenv
, lib
}@args:
, lua
}:
self:
let
packages = ( self:
let
callPackage = pkgs.newScope self;
inherit (self) callPackage;
buildLuaApplication = args: buildLuarocksPackage ({ namePrefix = ""; } // args);
buildLuarocksPackage = lib.makeOverridable(callPackage ../development/interpreters/lua-5/build-lua-package.nix {
inherit lua;
inherit (pkgs) lib;
inherit (luaLib) toLuaModule;
});
buildLuarocksPackage = lib.makeOverridable (callPackage ../development/interpreters/lua-5/build-lua-package.nix { });
luaLib = import ../development/lua-modules/lib.nix {
inherit (pkgs) lib;
inherit pkgs lua;
};
luaLib = callPackage ../development/lua-modules/lib.nix { };
#define build lua package function
buildLuaPackage = callPackage ../development/lua-modules/generic {
inherit writeText;
};
buildLuaPackage = callPackage ../development/lua-modules/generic { };
getPath = drv: pathListForVersion:
lib.concatMapStringsSep ";" (path: "${drv}/${path}") pathListForVersion;
in
{
# Dont take luaPackages from "global" pkgs scope to avoid mixing lua versions
luaPackages = self;
# helper functions for dealing with LUA_PATH and LUA_CPATH
lib = luaLib;
inherit luaLib;
getLuaPath = drv: getPath drv luaLib.luaPathList;
getLuaCPath = drv: getPath drv luaLib.luaCPathList;
inherit (callPackage ../development/interpreters/lua-5/hooks { inherit (args) lib;})
inherit (callPackage ../development/interpreters/lua-5/hooks { })
luarocksMoveDataFolder luarocksCheckHook lua-setup-hook;
inherit lua callPackage;
inherit lua;
inherit buildLuaPackage buildLuarocksPackage buildLuaApplication;
inherit (luaLib) luaOlder luaAtLeast isLua51 isLua52 isLua53 isLuaJIT
requiredLuaModules toLuaModule hasLuaModule;
# wraps programs in $out/bin with valid LUA_PATH/LUA_CPATH
wrapLua = callPackage ../development/interpreters/lua-5/wrap-lua.nix {
inherit lua lib;
inherit (pkgs.buildPackages) makeSetupHook makeWrapper;
};
luarocks = callPackage ../development/tools/misc/luarocks/default.nix {
inherit lua lib;
};
luarocks = callPackage ../development/tools/misc/luarocks/default.nix { };
# a fork of luarocks used to generate nix lua derivations from rockspecs
luarocks-nix = callPackage ../development/tools/misc/luarocks/luarocks-nix.nix { };
luxio = buildLuaPackage {
luxio = callPackage ({ fetchurl, which, pkg-config }: buildLuaPackage {
pname = "luxio";
version = "13";
@ -102,14 +91,13 @@ in
maintainers = with maintainers; [ richardipsum ];
platforms = platforms.unix;
};
};
});
nfd = callPackage ../development/lua-modules/nfd {
inherit (lib) maintainers;
inherit (pkgs.gnome) zenity;
};
vicious = luaLib.toLuaModule( stdenv.mkDerivation rec {
vicious = (callPackage ({ fetchFromGitHub }: stdenv.mkDerivation rec {
pname = "vicious";
version = "2.5.1";
@ -135,7 +123,6 @@ in
maintainers = with maintainers; [ makefu mic92 McSinyx ];
platforms = platforms.linux;
};
});
}) {});
});
in packages
}