3
0
Fork 0
forked from mirrors/nixpkgs

lua-modules/overrides.nix: using pkgs. messes up splicing, dont use it

commands used and then added -*'s manually because the word match doesn't
match those

```
rg -o '\w*pkgs\.\w*' ./pkgs/development/lua-modules/overrides.nix | sort | uniq
sd 'pkgs.' '' --string-mode ./pkgs/development/lua-modules/overrides.nix
```
This commit is contained in:
Artturin 2022-08-24 19:34:46 +03:00
parent a59a6bc4ea
commit 0345bab9a6
2 changed files with 107 additions and 65 deletions

View file

@ -3,6 +3,7 @@
, lua
, packagesAttr
, stdenv
, callPackage
, overrides ? (final: prev: {})
}:
@ -14,10 +15,10 @@ let
inherit lua pkgs lib stdenv;
};
overridenPackages = import ./overrides.nix { inherit pkgs; };
overridenPackages = callPackage ./overrides.nix { };
generatedPackages = if (builtins.pathExists ./generated-packages.nix) then
(final: prev: pkgs.callPackage ./generated-packages.nix { inherit (final) callPackage; } final prev) else (final: prev: {});
(final: prev: callPackage ./generated-packages.nix { inherit (final) callPackage; } final prev) else (final: prev: {});
extensions = lib.composeManyExtensions [
generatedPackages

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} \
@ -31,13 +72,13 @@ with prev;
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;
@ -46,7 +87,7 @@ with prev;
"${date}-${rev}";
nativeBuildInputs = oa.nativeBuildInputs ++ [
pkgs.gnum4
gnum4
];
# Upstream rockspec is pointlessly broken into separate rockspecs, per Lua
@ -67,13 +108,13 @@ with prev;
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";
@ -87,11 +128,11 @@ with prev;
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
];
});
@ -99,7 +140,7 @@ with prev;
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";
@ -112,19 +153,19 @@ 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";
@ -140,22 +181,22 @@ with prev;
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";
};
@ -171,8 +212,8 @@ with prev;
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)
@ -181,25 +222,25 @@ with prev;
lrexlib-gnu = prev.luaLib.overrideLuarocks prev.lrexlib-gnu (drv: {
buildInputs = [
pkgs.gnulib
gnulib
];
});
lrexlib-pcre = prev.luaLib.overrideLuarocks prev.lrexlib-pcre (drv: {
externalDeps = [
{ name = "PCRE"; dep = pkgs.pcre; }
{ name = "PCRE"; dep = pcre; }
];
});
lrexlib-posix = prev.luaLib.overrideLuarocks prev.lrexlib-posix (drv: {
buildInputs = [
pkgs.glibc.dev
glibc.dev
];
});
lua-iconv = prev.luaLib.overrideLuarocks prev.lua-iconv (drv: {
buildInputs = [
pkgs.libiconv
libiconv
];
});
@ -213,7 +254,7 @@ with prev;
lua-zlib = prev.luaLib.overrideLuarocks prev.lua-zlib (drv: {
buildInputs = [
pkgs.zlib.dev
zlib.dev
];
disabled = luaOlder "5.1" || luaAtLeast "5.4";
});
@ -221,24 +262,24 @@ with prev;
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.luaLib.overrideLuarocks prev.luadbi-postgresql (drv: {
buildInputs = [
pkgs.postgresql
postgresql
];
});
luadbi-sqlite3 = prev.luaLib.overrideLuarocks prev.luadbi-sqlite3 (drv: {
externalDeps = [
{ name = "SQLITE"; dep = pkgs.sqlite; }
{ name = "SQLITE"; dep = sqlite; }
];
});
@ -247,14 +288,14 @@ with prev;
luasocket
];
externalDeps = [
{ name = "EVENT"; dep = pkgs.libevent; }
{ name = "EVENT"; dep = libevent; }
];
disabled = luaOlder "5.1" || luaAtLeast "5.4";
});
luaexpat = prev.luaLib.overrideLuarocks prev.luaexpat (drv: {
externalDeps = [
{ name = "EXPAT"; dep = pkgs.expat; }
{ name = "EXPAT"; dep = expat; }
];
});
@ -262,7 +303,7 @@ with prev;
# but are in luajitPackages?
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 {
src = fetchFromGitHub {
owner = "facebook";
repo = "luaffifb";
rev = "532c757e51c86f546a85730b71c9fef15ffa633d";
@ -275,53 +316,53 @@ with prev;
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.luaLib.overrideLuarocks prev.luasec (drv: {
externalDeps = [
{ name = "OPENSSL"; dep = pkgs.openssl_1_1; }
{ name = "OPENSSL"; dep = openssl_1_1; }
];
});
luasql-sqlite3 = prev.luaLib.overrideLuarocks prev.luasql-sqlite3 (drv: {
externalDeps = [
{ name = "SQLITE"; dep = pkgs.sqlite; }
{ name = "SQLITE"; dep = sqlite; }
];
});
luasystem = prev.luaLib.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.luaLib.overrideLuarocks prev.luazip (drv: {
buildInputs = [
pkgs.zziplib
zziplib
];
});
lua-yajl = prev.luaLib.overrideLuarocks prev.lua-yajl (drv: {
buildInputs = [
pkgs.yajl
yajl
];
});
luaunbound = prev.luaLib.overrideLuarocks prev.luaunbound (drv: {
externalDeps = [
{ name = "libunbound"; dep = pkgs.unbound; }
{ name = "libunbound"; dep = unbound; }
];
});
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.
@ -341,7 +382,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;
@ -359,15 +400,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.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 = {
@ -387,12 +428,12 @@ with prev;
lyaml = prev.luaLib.overrideLuarocks prev.lyaml (oa: {
buildInputs = [
pkgs.libyaml
libyaml
];
});
mpack = prev.luaLib.overrideLuarocks prev.mpack (drv: {
buildInputs = [ pkgs.libmpack ];
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";
@ -410,30 +451,30 @@ with prev;
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.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' }"
'';
@ -456,7 +497,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