@ -1,11 +1,11 @@
{ pkgs , . . . }:
self : super :
with super ;
{ pkgs }:
final : prev :
with prev ;
{
##########################################3
#### manual fixes for generated packages
##########################################3
bit32 = super . bit32 . override ( {
bit32 = prev . bit32 . overrideAttrs ( oa : {
# Small patch in order to no longer redefine a Lua 5.2 function that Luajit
# 2.1 also provides, see https://github.com/LuaJIT/LuaJIT/issues/325 for
# more
@ -14,7 +14,7 @@ with super;
] ;
} ) ;
busted = super . busted . override ( {
busted = prev . busted . overrideAttrs ( oa : {
postConfigure = ''
substituteInPlace '' ${ rockspecFilename } \
- - replace " ' l u a _ c l i a r g s = 3 . 0 - 1 ' , " " ' l u a _ c l i a r g s > = 3 . 0 - 1 ' , "
@ -25,14 +25,7 @@ with super;
'' ;
} ) ;
cqueues = super . cqueues . override ( rec {
# Parse out a version number without the Lua version inserted
version = with pkgs . lib ; let
version' = super . cqueues . version ;
rel = splitVersion version' ;
date = head rel ;
rev = last ( splitString " - " ( last rel ) ) ;
in " ${ date } - ${ rev } " ;
cqueues = ( prev . lib . overrideLuarocks prev . cqueues ( drv : {
nativeBuildInputs = [
pkgs . gnum4
] ;
@ -41,9 +34,17 @@ with super;
{ name = " O P E N S S L " ; dep = pkgs . openssl ; }
] ;
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' = prev . cqueues . version ;
rel = splitVersion version' ;
date = head rel ;
rev = last ( splitString " - " ( last rel ) ) ;
in " ${ date } - ${ rev } " ;
# Upstream rockspec is pointlessly broken into separate rockspecs, per Lua
# version, which doesn't work well for us, so modify it
postConfigure = let inherit ( super . 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 } \
@ -56,13 +57,13 @@ with super;
'' ;
} ) ;
cyrussasl = super . cyrussasl . override ( {
cyrussasl = prev . lib . overrideLuarocks prev . cyrussasl ( drv : {
externalDeps = [
{ name = " L I B S A S L " ; dep = pkgs . cyrus_sasl ; }
] ;
} ) ;
http = super . http . override ( {
http = prev . http . overrideAttrs ( oa : {
patches = [
( pkgs . fetchpatch {
name = " i n v a l i d - s t a t e - p r o g r e s s i o n . p a t c h " ;
@ -76,7 +77,7 @@ with super;
* /
} ) ;
ldbus = super . ldbus . override ( {
ldbus = prev . lib . overrideLuarocks prev . ldbus ( drv : {
extraVariables = {
DBUS_DIR = " ${ pkgs . dbus . lib } " ;
DBUS_ARCH_INCDIR = " ${ pkgs . dbus . lib } / l i b / d b u s - 1 . 0 / i n c l u d e " ;
@ -87,7 +88,7 @@ with super;
] ;
} ) ;
ljsyscall = super . ljsyscall . override ( rec {
ljsyscall = prev . ljsyscall . overrideAttrs ( oa : rec {
version = " u n s t a b l e - 2 0 1 8 0 5 1 5 " ;
# package hasn't seen any release for a long time
src = pkgs . fetchFromGitHub {
@ -106,7 +107,7 @@ with super;
propagatedBuildInputs = with pkgs . lib ; optional ( ! isLuaJIT ) luaffi ;
} ) ;
lgi = super . lgi . override ( {
lgi = prev . lib . overrideLuarocks prev . lgi ( drv : {
nativeBuildInputs = [
pkgs . pkg-config
] ;
@ -128,31 +129,31 @@ with super;
'' ;
} ) ;
lrexlib-gnu = super . lrexlib-gnu . override ( {
lrexlib-gnu = prev . lib . overrideLuarocks prev . lrexlib-gnu ( drv : {
buildInputs = [
pkgs . gnulib
] ;
} ) ;
lrexlib-pcre = super . lrexlib-pcre . override ( {
lrexlib-pcre = prev . lib . overrideLuarocks prev . lrexlib-pcre ( drv : {
externalDeps = [
{ name = " P C R E " ; dep = pkgs . pcre ; }
] ;
} ) ;
lrexlib-posix = super . lrexlib-posix . override ( {
lrexlib-posix = prev . lib . overrideLuarocks prev . lrexlib-posix ( drv : {
buildInputs = [
pkgs . glibc . dev
] ;
} ) ;
lua-iconv = super . lua-iconv . override ( {
lua-iconv = prev . lib . overrideLuarocks prev . lua-iconv ( drv : {
buildInputs = [
pkgs . libiconv
] ;
} ) ;
lua-lsp = super . lua-lsp . override ( {
lua-lsp = prev . lua-lsp . overrideAttrs ( oa : {
# until Alloyed/lua-lsp#28
postConfigure = ''
substituteInPlace '' ${ rockspecFilename } \
@ -160,14 +161,14 @@ with super;
'' ;
} ) ;
lua-zlib = super . lua-z lib. override ( {
lua-zlib = prev . lib . overrideLuarocks prev . lua-zlib ( drv : {
buildInputs = [
pkgs . zlib . dev
] ;
disabled = luaOlder " 5 . 1 " || luaAtLeast " 5 . 4 " ;
} ) ;
luadbi-mysql = super . luadbi-mysql . override ( {
luadbi-mysql = prev . lib . overrideLuarocks prev . luadbi-mysql ( drv : {
extraVariables = {
# Can't just be /include and /lib, unfortunately needs the trailing 'mysql'
MYSQL_INCDIR = " ${ pkgs . libmysqlclient . dev } / i n c l u d e / m y s q l " ;
@ -179,19 +180,19 @@ with super;
] ;
} ) ;
luadbi-postgresql = super . luadbi-postgresql . override ( {
luadbi-postgresql = prev . lib . overrideLuarocks prev . luadbi-postgresql ( drv : {
buildInputs = [
pkgs . postgresql
] ;
} ) ;
luadbi-sqlite3 = super . luadbi-sqlite3 . override ( {
luadbi-sqlite3 = prev . lib . overrideLuarocks prev . luadbi-sqlite3 ( drv : {
externalDeps = [
{ name = " S Q L I T E " ; dep = pkgs . sqlite ; }
] ;
} ) ;
luaevent = super . luaevent . override ( {
luaevent = prev . lib . overrideLuarocks prev . luaevent ( drv : {
propagatedBuildInputs = [
luasocket
] ;
@ -201,7 +202,7 @@ with super;
disabled = luaOlder " 5 . 1 " || luaAtLeast " 5 . 4 " ;
} ) ;
luaexpat = super . luaexpat . override ( {
luaexpat = prev . lib . overrideLuarocks prev . luaexpat ( drv : {
externalDeps = [
{ name = " E X P A T " ; dep = pkgs . expat ; }
] ;
@ -212,59 +213,57 @@ with super;
# TODO Somehow automatically amend buildInputs for things that need luaffi
# but are in luajitPackages?
luaffi = super . luaffi . override ( {
luaffi = prev . lib . overrideLuarocks prev . luaffi ( drv : {
# The packaged .src.rock version is pretty old, and doesn't work with Lua 5.3
src = pkgs . fetchFromGitHub {
owner = " f a c e b o o k " ; repo = " l u a f f i f b " ;
rev = " 5 3 2 c 7 5 7 e 5 1 c 8 6 f 5 4 6 a 8 5 7 3 0 b 7 1 c 9 f e f 1 5 f f a 6 3 3 d " ;
sha256 = " 1 n w x 6 s h 5 6 z f q 9 9 r c s 7 s p h 0 2 9 6 j f 6 a 9 z 7 2 m x k n n 0 y s w 9 f d 7 m 1 r 8 i g " ;
} ;
knownRockspec = with super . luaffi ; " ${ pname } - ${ version } . r o c k s p e c " ;
knownRockspec = with prev . luaffi ; " ${ pname } - ${ version } . r o c k s p e c " ;
disabled = luaOlder " 5 . 1 " || luaAtLeast " 5 . 4 " || isLuaJIT ;
} ) ;
luaossl = super . luaossl . override ( {
luaossl = prev . lib . overrideLuarocks prev . luaossl ( drv : {
externalDeps = [
{ name = " C R Y P T O " ; dep = pkgs . openssl ; }
{ name = " O P E N S S L " ; dep = pkgs . openssl ; }
] ;
} ) ;
luasec = super . luasec . override ( {
luasec = prev . lib . overrideLuarocks prev . luasec ( drv : {
externalDeps = [
{ name = " O P E N S S L " ; dep = pkgs . openssl ; }
] ;
} ) ;
luasql-sqlite3 = super . luasql-sqlite3 . override ( {
luasql-sqlite3 = prev . lib . overrideLuarocks prev . luasql-sqlite3 ( drv : {
externalDeps = [
{ name = " S Q L I T E " ; dep = pkgs . sqlite ; }
] ;
} ) ;
luasystem = super . luasystem . override ( {
buildInputs = pkgs . lib . optionals pkgs . stdenv . isLinux [
pkgs . glibc
] ;
} ) ;
luasystem = prev . lib . overrideLuarocks prev . luasystem ( drv : { buildInputs = [ pkgs . glibc . out ] ; } ) ;
luazip = super . luazip . override ( {
luazip = prev . lib . overrideLuarocks prev . luazip ( drv : {
buildInputs = [
pkgs . zziplib
] ;
} ) ;
lua-yajl = super . lua-yajl . override ( {
lua-yajl = prev . lib . overrideLuarocks prev . lua-yajl ( drv : {
buildInputs = [
pkgs . yajl
] ;
} ) ;
luuid = super . luuid . override ( ol d: {
luuid = ( prev . lib . overrideLuarocks prev . luuid ( drv : {
externalDeps = [
{ name = " L I B U U I D " ; dep = pkgs . libuuid ; }
] ;
meta = old . meta // {
disabled = luaOlder " 5 . 1 " || ( luaAtLeast " 5 . 4 " ) ;
} ) ) . overrideAttrs ( oa : {
meta = oa . meta // {
platforms = pkgs . lib . platforms . linux ;
} ;
# Trivial patch to make it work in both 5.1 and 5.2. Basically just the
@ -276,13 +275,12 @@ with super;
patches = [
./luuid.patch
] ;
postConfigure = let inherit ( super . luuid ) version pname ; in ''
postConfigure = let inherit ( prev . luuid ) version pname ; in ''
sed - Ei '' ${ rockspecFilename } - e ' s | l u a > = 5 . 2 | l u a > = 5 . 1 , | '
'' ;
disabled = luaOlder " 5 . 1 " || ( luaAtLeast " 5 . 4 " ) ;
} ) ;
luv = super . luv . override ( {
luv = prev . lib . overrideLuarocks prev . luv ( drv : {
# Use system libuv instead of building local and statically linking
# This is a hacky way to specify -DWITH_SHARED_LIBUV=ON which
# is not possible with luarocks and the current luv rockspec
@ -296,8 +294,8 @@ with super;
buildInputs = [ pkgs . libuv ] ;
passthru = {
libluv = self . luv . override ( {
preBuild = self . luv . preBuild + ''
libluv = final . luv . overrideAttrs ( oa : {
preBuild = final . luv . preBuild + ''
sed - i ' s , \ ( option ( BUILD_MODULE . * \ ) ON , \ 1 OFF , ' CMakeLists . txt
sed - i ' s , \ ( option ( BUILD_SHARED_LIBS . * \ ) OFF , \ 1 ON , ' CMakeLists . txt
sed - i ' s , $ { " \$ { . * I N S T A L L _ I N C _ D I R } " } , $ { placeholder " o u t " } /include/luv , ' CMakeLists . txt
@ -312,32 +310,32 @@ with super;
} ;
} ) ;
lyaml = super . lyaml . override ( {
lyaml = prev . lib . overrideLuarocks prev . lyaml ( oa : {
buildInputs = [
pkgs . libyaml
] ;
} ) ;
mpack = super . mpack . override ( {
mpack = prev . lib . overrideLuarocks prev . mpack ( drv : {
buildInputs = [ pkgs . libmpack ] ;
# the rockspec doesn't use the makefile so you may need to export more flags
USE_SYSTEM_LUA = " y e s " ;
USE_SYSTEM_MPACK = " y e s " ;
} ) ;
rapidjson = super . rapidjson . override ( {
rapidjson = prev . rapidjson . overrideAttrs ( oa : {
preBuild = ''
sed - i ' /set ( CMAKE_CXX_FLAGS/d ' CMakeLists . txt
sed - i ' /set ( CMAKE_C_FLAGS/d ' CMakeLists . txt
'' ;
} ) ;
readline = ( super . readline . override ( {
readline = ( prev . lib . overrideLuarocks prev . readline ( drv : {
unpackCmd = ''
unzip " $ c u r S r c "
tar xf * . tar . gz
'' ;
propagatedBuildInputs = super . readline . propagatedBuildInputs ++ [ pkgs . readline ] ;
propagatedBuildInputs = prev . readline . propagatedBuildInputs ++ [ pkgs . readline . out ] ;
extraVariables = rec {
READLINE_INCDIR = " ${ pkgs . readline . dev } / i n c l u d e " ;
HISTORY_INCDIR = READLINE_INCDIR ;
@ -349,14 +347,14 @@ with super;
'' ;
} ) ;
std-_debug = super . std-_debug . overrideAttrs ( oa : {
std-_debug = prev . std-_debug . overrideAttrs ( oa : {
# run make to generate lib/std/_debug/version.lua
preConfigure = ''
make all
'' ;
} ) ;
std-normalize = super . std-normalize . overrideAttrs ( oa : {
std-normalize = prev . std-normalize . overrideAttrs ( oa : {
# run make to generate lib/std/_debug/version.lua
preConfigure = ''
make all
@ -365,10 +363,10 @@ with super;
# TODO just while testing, remove afterwards
# toVimPlugin should do it instead
gitsigns-nvim = super . gitsigns-nvim . overrideAttrs ( oa : {
gitsigns-nvim = prev . gitsigns-nvim . overrideAttrs ( oa : {
nativeBuildInputs = oa . nativeBuildInputs or [ ] ++ [ pkgs . vimUtils . vimGenDocHook ] ;
} ) ;
# aliases
cjson = super . lua-cjson ;
cjson = prev . lua-cjson ;
}