Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 21.05 350 lines 10 kB view raw
1{ pkgs, ... }: 2self: super: 3with super; 4{ 5 ##########################################3 6 #### manual fixes for generated packages 7 ##########################################3 8 bit32 = super.bit32.override({ 9 # Small patch in order to no longer redefine a Lua 5.2 function that Luajit 10 # 2.1 also provides, see https://github.com/LuaJIT/LuaJIT/issues/325 for 11 # more 12 patches = [ 13 ./bit32.patch 14 ]; 15 }); 16 17 busted = super.busted.override({ 18 postConfigure = '' 19 substituteInPlace ''${rockspecFilename} \ 20 --replace "'lua_cliargs = 3.0-1'," "'lua_cliargs >= 3.0-1'," 21 ''; 22 postInstall = '' 23 install -D completions/zsh/_busted $out/share/zsh/site-functions/_busted 24 install -D completions/bash/busted.bash $out/share/bash-completion/completions/busted 25 ''; 26 }); 27 28 cqueues = super.cqueues.override(rec { 29 # Parse out a version number without the Lua version inserted 30 version = with pkgs.lib; let 31 version' = super.cqueues.version; 32 rel = splitVersion version'; 33 date = head rel; 34 rev = last (splitString "-" (last rel)); 35 in "${date}-${rev}"; 36 nativeBuildInputs = [ 37 pkgs.gnum4 38 ]; 39 externalDeps = [ 40 { name = "CRYPTO"; dep = pkgs.openssl; } 41 { name = "OPENSSL"; dep = pkgs.openssl; } 42 ]; 43 disabled = luaOlder "5.1" || luaAtLeast "5.4"; 44 # Upstream rockspec is pointlessly broken into separate rockspecs, per Lua 45 # version, which doesn't work well for us, so modify it 46 postConfigure = let inherit (super.cqueues) pname; in '' 47 # 'all' target auto-detects correct Lua version, which is fine for us as 48 # we only have the right one available :) 49 sed -Ei ''${rockspecFilename} \ 50 -e 's|lua == 5.[[:digit:]]|lua >= 5.1, <= 5.3|' \ 51 -e 's|build_target = "[^"]+"|build_target = "all"|' \ 52 -e 's|version = "[^"]+"|version = "${version}"|' 53 specDir=$(dirname ''${rockspecFilename}) 54 cp ''${rockspecFilename} "$specDir/${pname}-${version}.rockspec" 55 rockspecFilename="$specDir/${pname}-${version}.rockspec" 56 ''; 57 }); 58 59 cyrussasl = super.cyrussasl.override({ 60 externalDeps = [ 61 { name = "LIBSASL"; dep = pkgs.cyrus_sasl; } 62 ]; 63 }); 64 65 http = super.http.override({ 66 patches = [ 67 (pkgs.fetchpatch { 68 name = "invalid-state-progression.patch"; 69 url = "https://github.com/daurnimator/lua-http/commit/cb7b59474a.diff"; 70 sha256 = "1vmx039n3nqfx50faqhs3wgiw28ws416rhw6vh6srmh9i826dac7"; 71 }) 72 ]; 73 /* TODO: separate docs derivation? (pandoc is heavy) 74 nativeBuildInputs = [ pandoc ]; 75 makeFlags = [ "-C doc" "lua-http.html" "lua-http.3" ]; 76 */ 77 }); 78 79 ldbus = super.ldbus.override({ 80 extraVariables = { 81 DBUS_DIR="${pkgs.dbus.lib}"; 82 DBUS_ARCH_INCDIR="${pkgs.dbus.lib}/lib/dbus-1.0/include"; 83 DBUS_INCDIR="${pkgs.dbus.dev}/include/dbus-1.0"; 84 }; 85 buildInputs = with pkgs; [ 86 dbus 87 ]; 88 }); 89 90 ljsyscall = super.ljsyscall.override(rec { 91 version = "unstable-20180515"; 92 # package hasn't seen any release for a long time 93 src = pkgs.fetchFromGitHub { 94 owner = "justincormack"; 95 repo = "ljsyscall"; 96 rev = "e587f8c55aad3955dddab3a4fa6c1968037b5c6e"; 97 sha256 = "06v52agqyziwnbp2my3r7liv245ddmb217zmyqakh0ldjdsr8lz4"; 98 }; 99 knownRockspec = "rockspec/ljsyscall-scm-1.rockspec"; 100 # actually library works fine with lua 5.2 101 preConfigure = '' 102 sed -i 's/lua == 5.1/lua >= 5.1, < 5.3/' ${knownRockspec} 103 ''; 104 disabled = luaOlder "5.1" || luaAtLeast "5.3"; 105 106 propagatedBuildInputs = with pkgs.lib; optional (!isLuaJIT) luaffi; 107 }); 108 109 lgi = super.lgi.override({ 110 nativeBuildInputs = [ 111 pkgs.pkg-config 112 ]; 113 buildInputs = [ 114 pkgs.glib 115 pkgs.gobject-introspection 116 ]; 117 patches = [ 118 (pkgs.fetchpatch { 119 name = "lgi-find-cairo-through-typelib.patch"; 120 url = "https://github.com/psychon/lgi/commit/46a163d9925e7877faf8a4f73996a20d7cf9202a.patch"; 121 sha256 = "0gfvvbri9kyzhvq3bvdbj2l6mwvlz040dk4mrd5m9gz79f7w109c"; 122 }) 123 ]; 124 }); 125 126 lrexlib-gnu = super.lrexlib-gnu.override({ 127 buildInputs = [ 128 pkgs.gnulib 129 ]; 130 }); 131 132 lrexlib-pcre = super.lrexlib-pcre.override({ 133 externalDeps = [ 134 { name = "PCRE"; dep = pkgs.pcre; } 135 ]; 136 }); 137 138 lrexlib-posix = super.lrexlib-posix.override({ 139 buildInputs = [ 140 pkgs.glibc.dev 141 ]; 142 }); 143 144 ltermbox = super.ltermbox.override( { 145 disabled = !isLua51 || isLuaJIT; 146 }); 147 148 lua-iconv = super.lua-iconv.override({ 149 buildInputs = [ 150 pkgs.libiconv 151 ]; 152 }); 153 154 lua-lsp = super.lua-lsp.override({ 155 # until Alloyed/lua-lsp#28 156 postConfigure = '' 157 substituteInPlace ''${rockspecFilename} \ 158 --replace '"lpeglabel ~> 1.5",' '"lpeglabel >= 1.5",' 159 ''; 160 }); 161 162 lua-zlib = super.lua-zlib.override({ 163 buildInputs = [ 164 pkgs.zlib.dev 165 ]; 166 disabled = luaOlder "5.1" || luaAtLeast "5.4"; 167 }); 168 169 luadbi-mysql = super.luadbi-mysql.override({ 170 extraVariables = { 171 # Can't just be /include and /lib, unfortunately needs the trailing 'mysql' 172 MYSQL_INCDIR="${pkgs.libmysqlclient.dev}/include/mysql"; 173 MYSQL_LIBDIR="${pkgs.libmysqlclient}/lib/mysql"; 174 }; 175 buildInputs = [ 176 pkgs.mysql.client 177 pkgs.libmysqlclient 178 ]; 179 }); 180 181 luadbi-postgresql = super.luadbi-postgresql.override({ 182 buildInputs = [ 183 pkgs.postgresql 184 ]; 185 }); 186 187 luadbi-sqlite3 = super.luadbi-sqlite3.override({ 188 externalDeps = [ 189 { name = "SQLITE"; dep = pkgs.sqlite; } 190 ]; 191 }); 192 193 luaevent = super.luaevent.override({ 194 propagatedBuildInputs = [ 195 luasocket 196 ]; 197 externalDeps = [ 198 { name = "EVENT"; dep = pkgs.libevent; } 199 ]; 200 disabled = luaOlder "5.1" || luaAtLeast "5.4"; 201 }); 202 203 luaexpat = super.luaexpat.override({ 204 externalDeps = [ 205 { name = "EXPAT"; dep = pkgs.expat; } 206 ]; 207 patches = [ 208 ./luaexpat.patch 209 ]; 210 }); 211 212 # TODO Somehow automatically amend buildInputs for things that need luaffi 213 # but are in luajitPackages? 214 luaffi = super.luaffi.override({ 215 # The packaged .src.rock version is pretty old, and doesn't work with Lua 5.3 216 src = pkgs.fetchFromGitHub { 217 owner = "facebook"; repo = "luaffifb"; 218 rev = "532c757e51c86f546a85730b71c9fef15ffa633d"; 219 sha256 = "1nwx6sh56zfq99rcs7sph0296jf6a9z72mxknn0ysw9fd7m1r8ig"; 220 }; 221 knownRockspec = with super.luaffi; "${pname}-${version}.rockspec"; 222 disabled = luaOlder "5.1" || luaAtLeast "5.4" || isLuaJIT; 223 }); 224 225 luaossl = super.luaossl.override({ 226 externalDeps = [ 227 { name = "CRYPTO"; dep = pkgs.openssl; } 228 { name = "OPENSSL"; dep = pkgs.openssl; } 229 ]; 230 }); 231 232 luasec = super.luasec.override({ 233 externalDeps = [ 234 { name = "OPENSSL"; dep = pkgs.openssl; } 235 ]; 236 }); 237 238 luasql-sqlite3 = super.luasql-sqlite3.override({ 239 externalDeps = [ 240 { name = "SQLITE"; dep = pkgs.sqlite; } 241 ]; 242 }); 243 244 luasystem = super.luasystem.override({ 245 buildInputs = pkgs.lib.optionals pkgs.stdenv.isLinux [ 246 pkgs.glibc 247 ]; 248 }); 249 250 luazip = super.luazip.override({ 251 buildInputs = [ 252 pkgs.zziplib 253 ]; 254 }); 255 256 lua-yajl = super.lua-yajl.override({ 257 buildInputs = [ 258 pkgs.yajl 259 ]; 260 }); 261 262 luuid = super.luuid.override(old: { 263 externalDeps = [ 264 { name = "LIBUUID"; dep = pkgs.libuuid; } 265 ]; 266 meta = old.meta // { 267 platforms = pkgs.lib.platforms.linux; 268 }; 269 # Trivial patch to make it work in both 5.1 and 5.2. Basically just the 270 # tiny diff between the two upstream versions placed behind an #if. 271 # Upstreams: 272 # 5.1: http://webserver2.tecgraf.puc-rio.br/~lhf/ftp/lua/5.1/luuid.tar.gz 273 # 5.2: http://webserver2.tecgraf.puc-rio.br/~lhf/ftp/lua/5.2/luuid.tar.gz 274 patchFlags = [ "-p2" ]; 275 patches = [ 276 ./luuid.patch 277 ]; 278 postConfigure = let inherit (super.luuid) version pname; in '' 279 sed -Ei ''${rockspecFilename} -e 's|lua >= 5.2|lua >= 5.1,|' 280 ''; 281 disabled = luaOlder "5.1" || (luaAtLeast "5.4"); 282 }); 283 284 luv = super.luv.override({ 285 # Use system libuv instead of building local and statically linking 286 # This is a hacky way to specify -DWITH_SHARED_LIBUV=ON which 287 # is not possible with luarocks and the current luv rockspec 288 # While at it, remove bundled libuv source entirely to be sure. 289 # We may wish to drop bundled lua submodules too... 290 preBuild = '' 291 sed -i 's,\(option(WITH_SHARED_LIBUV.*\)OFF,\1ON,' CMakeLists.txt 292 rm -rf deps/libuv 293 ''; 294 295 buildInputs = [ pkgs.libuv ]; 296 297 passthru = { 298 libluv = self.luv.override ({ 299 preBuild = self.luv.preBuild + '' 300 sed -i 's,\(option(BUILD_MODULE.*\)ON,\1OFF,' CMakeLists.txt 301 sed -i 's,\(option(BUILD_SHARED_LIBS.*\)OFF,\1ON,' CMakeLists.txt 302 sed -i 's,${"\${INSTALL_INC_DIR}"},${placeholder "out"}/include/luv,' CMakeLists.txt 303 ''; 304 305 nativeBuildInputs = [ pkgs.fixDarwinDylibNames ]; 306 307 # Fixup linking libluv.dylib, for some reason it's not linked against lua correctly. 308 NIX_LDFLAGS = pkgs.lib.optionalString pkgs.stdenv.isDarwin 309 (if isLuaJIT then "-lluajit-${lua.luaversion}" else "-llua"); 310 }); 311 }; 312 }); 313 314 lyaml = super.lyaml.override({ 315 buildInputs = [ 316 pkgs.libyaml 317 ]; 318 }); 319 320 mpack = super.mpack.override({ 321 buildInputs = [ pkgs.libmpack ]; 322 # the rockspec doesn't use the makefile so you may need to export more flags 323 USE_SYSTEM_LUA = "yes"; 324 USE_SYSTEM_MPACK = "yes"; 325 }); 326 327 rapidjson = super.rapidjson.override({ 328 preBuild = '' 329 sed -i '/set(CMAKE_CXX_FLAGS/d' CMakeLists.txt 330 sed -i '/set(CMAKE_C_FLAGS/d' CMakeLists.txt 331 ''; 332 }); 333 334 readline = (super.readline.override ({ 335 unpackCmd = '' 336 unzip "$curSrc" 337 tar xf *.tar.gz 338 ''; 339 propagatedBuildInputs = super.readline.propagatedBuildInputs ++ [ pkgs.readline ]; 340 extraVariables = rec { 341 READLINE_INCDIR = "${pkgs.readline.dev}/include"; 342 HISTORY_INCDIR = READLINE_INCDIR; 343 }; 344 })).overrideAttrs (old: { 345 # Without this, source root is wrongly set to ./readline-2.6/doc 346 setSourceRoot = '' 347 sourceRoot=./readline-2.6 348 ''; 349 }); 350}