Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 19.09 287 lines 8.4 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 = splitString "." 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 44 # https://github.com/wahern/cqueues/issues/227 45 NIX_CFLAGS_COMPILE = if pkgs.stdenv.hostPlatform.isDarwin then [ "-DCLOCK_MONOTONIC" "-DCLOCK_REALTIME" ] else null; 46 47 disabled = luaOlder "5.1" || luaAtLeast "5.4"; 48 # Upstream rockspec is pointlessly broken into separate rockspecs, per Lua 49 # version, which doesn't work well for us, so modify it 50 postConfigure = let inherit (super.cqueues) pname; in '' 51 # 'all' target auto-detects correct Lua version, which is fine for us as 52 # we only have the right one available :) 53 sed -Ei ''${rockspecFilename} \ 54 -e 's|lua == 5.[[:digit:]]|lua >= 5.1, <= 5.3|' \ 55 -e 's|build_target = "[^"]+"|build_target = "all"|' \ 56 -e 's|version = "[^"]+"|version = "${version}"|' 57 specDir=$(dirname ''${rockspecFilename}) 58 cp ''${rockspecFilename} "$specDir/${pname}-${version}.rockspec" 59 rockspecFilename="$specDir/${pname}-${version}.rockspec" 60 ''; 61 }); 62 63 cyrussasl = super.cyrussasl.override({ 64 externalDeps = [ 65 { name = "LIBSASL"; dep = pkgs.cyrus_sasl; } 66 ]; 67 }); 68 69 http = super.http.override({ 70 patches = [ 71 (pkgs.fetchpatch { 72 name = "invalid-state-progression.patch"; 73 url = "https://github.com/daurnimator/lua-http/commit/cb7b59474a.diff"; 74 sha256 = "1vmx039n3nqfx50faqhs3wgiw28ws416rhw6vh6srmh9i826dac7"; 75 }) 76 ]; 77 /* TODO: separate docs derivation? (pandoc is heavy) 78 nativeBuildInputs = [ pandoc ]; 79 makeFlags = [ "-C doc" "lua-http.html" "lua-http.3" ]; 80 */ 81 }); 82 83 ljsyscall = super.ljsyscall.override(rec { 84 version = "unstable-20180515"; 85 # package hasn't seen any release for a long time 86 src = pkgs.fetchFromGitHub { 87 owner = "justincormack"; 88 repo = "ljsyscall"; 89 rev = "e587f8c55aad3955dddab3a4fa6c1968037b5c6e"; 90 sha256 = "06v52agqyziwnbp2my3r7liv245ddmb217zmyqakh0ldjdsr8lz4"; 91 }; 92 knownRockspec = "rockspec/ljsyscall-scm-1.rockspec"; 93 # actually library works fine with lua 5.2 94 preConfigure = '' 95 sed -i 's/lua == 5.1/lua >= 5.1, < 5.3/' ${knownRockspec} 96 ''; 97 disabled = luaOlder "5.1" || luaAtLeast "5.3"; 98 99 propagatedBuildInputs = with pkgs.lib; optional (!isLuaJIT) luaffi; 100 }); 101 102 lgi = super.lgi.override({ 103 nativeBuildInputs = [ 104 pkgs.pkgconfig 105 ]; 106 buildInputs = [ 107 pkgs.glib 108 pkgs.gobjectIntrospection 109 ]; 110 patches = [ 111 (pkgs.fetchpatch { 112 name = "lgi-find-cairo-through-typelib.patch"; 113 url = "https://github.com/psychon/lgi/commit/46a163d9925e7877faf8a4f73996a20d7cf9202a.patch"; 114 sha256 = "0gfvvbri9kyzhvq3bvdbj2l6mwvlz040dk4mrd5m9gz79f7w109c"; 115 }) 116 ]; 117 }); 118 119 lrexlib-gnu = super.lrexlib-gnu.override({ 120 buildInputs = [ 121 pkgs.gnulib 122 ]; 123 }); 124 125 lrexlib-pcre = super.lrexlib-pcre.override({ 126 externalDeps = [ 127 { name = "PCRE"; dep = pkgs.pcre; } 128 ]; 129 }); 130 131 lrexlib-posix = super.lrexlib-posix.override({ 132 buildInputs = [ 133 pkgs.glibc.dev 134 ]; 135 }); 136 137 ltermbox = super.ltermbox.override( { 138 disabled = !isLua51 || isLuaJIT; 139 }); 140 141 lua-iconv = super.lua-iconv.override({ 142 buildInputs = [ 143 pkgs.libiconv 144 ]; 145 }); 146 147 lua-zlib = super.lua-zlib.override({ 148 buildInputs = [ 149 pkgs.zlib.dev 150 ]; 151 disabled = luaOlder "5.1" || luaAtLeast "5.4"; 152 }); 153 154 luadbi-mysql = super.luadbi-mysql.override({ 155 extraVariables = '' 156 -- Can't just be /include and /lib, unfortunately needs the trailing 'mysql' 157 MYSQL_INCDIR='${pkgs.lib.getDev pkgs.mysql.connector-c}/include/mysql'; 158 MYSQL_LIBDIR='${pkgs.mysql.connector-c}/lib/mysql'; 159 ''; 160 buildInputs = [ 161 pkgs.mysql.client 162 pkgs.mysql.connector-c 163 ]; 164 }); 165 166 luadbi-postgresql = super.luadbi-postgresql.override({ 167 buildInputs = [ 168 pkgs.postgresql 169 ]; 170 }); 171 172 luadbi-sqlite3 = super.luadbi-sqlite3.override({ 173 externalDeps = [ 174 { name = "SQLITE"; dep = pkgs.sqlite; } 175 ]; 176 }); 177 178 luaevent = super.luaevent.override({ 179 propagatedBuildInputs = [ 180 luasocket 181 ]; 182 externalDeps = [ 183 { name = "EVENT"; dep = pkgs.libevent; } 184 ]; 185 disabled = luaOlder "5.1" || luaAtLeast "5.4"; 186 }); 187 188 luaexpat = super.luaexpat.override({ 189 externalDeps = [ 190 { name = "EXPAT"; dep = pkgs.expat; } 191 ]; 192 }); 193 194 # TODO Somehow automatically amend buildInputs for things that need luaffi 195 # but are in luajitPackages? 196 luaffi = super.luaffi.override({ 197 # The packaged .src.rock version is pretty old, and doesn't work with Lua 5.3 198 src = pkgs.fetchFromGitHub { 199 owner = "facebook"; repo = "luaffifb"; 200 rev = "532c757e51c86f546a85730b71c9fef15ffa633d"; 201 sha256 = "1nwx6sh56zfq99rcs7sph0296jf6a9z72mxknn0ysw9fd7m1r8ig"; 202 }; 203 knownRockspec = with super.luaffi; "${pname}-${version}.rockspec"; 204 disabled = luaOlder "5.1" || luaAtLeast "5.4" || isLuaJIT; 205 }); 206 207 luaossl = super.luaossl.override({ 208 externalDeps = [ 209 { name = "CRYPTO"; dep = pkgs.openssl; } 210 { name = "OPENSSL"; dep = pkgs.openssl; } 211 ]; 212 }); 213 214 luasec = super.luasec.override({ 215 externalDeps = [ 216 { name = "OPENSSL"; dep = pkgs.openssl; } 217 ]; 218 }); 219 220 luasql-sqlite3 = super.luasql-sqlite3.override({ 221 externalDeps = [ 222 { name = "SQLITE"; dep = pkgs.sqlite; } 223 ]; 224 }); 225 226 luasystem = super.luasystem.override({ 227 buildInputs = [ 228 pkgs.glibc 229 ]; 230 }); 231 232 luazip = super.luazip.override({ 233 buildInputs = [ 234 pkgs.zziplib 235 ]; 236 }); 237 238 lua-yajl = super.lua-yajl.override({ 239 buildInputs = [ 240 pkgs.yajl 241 ]; 242 }); 243 244 luuid = super.luuid.override(old: { 245 externalDeps = [ 246 { name = "LIBUUID"; dep = pkgs.libuuid; } 247 ]; 248 meta = old.meta // { 249 platforms = pkgs.lib.platforms.linux; 250 }; 251 # Trivial patch to make it work in both 5.1 and 5.2. Basically just the 252 # tiny diff between the two upstream versions placed behind an #if. 253 # Upstreams: 254 # 5.1: http://webserver2.tecgraf.puc-rio.br/~lhf/ftp/lua/5.1/luuid.tar.gz 255 # 5.2: http://webserver2.tecgraf.puc-rio.br/~lhf/ftp/lua/5.2/luuid.tar.gz 256 patchFlags = "-p2"; 257 patches = [ 258 ./luuid.patch 259 ]; 260 postConfigure = let inherit (super.luuid) version pname; in '' 261 sed -Ei ''${rockspecFilename} -e 's|lua >= 5.2|lua >= 5.1,|' 262 ''; 263 disabled = luaOlder "5.1" || (luaAtLeast "5.4"); 264 }); 265 266 luv = super.luv.override({ 267 # Use system libuv instead of building local and statically linking 268 # This is a hacky way to specify -DWITH_SHARED_LIBUV=ON which 269 # is not possible with luarocks and the current luv rockspec 270 # While at it, remove bundled libuv source entirely to be sure. 271 # We may wish to drop bundled lua submodules too... 272 preBuild = '' 273 sed -i 's,\(option(WITH_SHARED_LIBUV.*\)OFF,\1ON,' CMakeLists.txt 274 rm -rf deps/libuv 275 ''; 276 propagatedBuildInputs = [ 277 pkgs.libuv 278 ]; 279 }); 280 281 rapidjson = super.rapidjson.override({ 282 preBuild = '' 283 sed -i '/set(CMAKE_CXX_FLAGS/d' CMakeLists.txt 284 sed -i '/set(CMAKE_C_FLAGS/d' CMakeLists.txt 285 ''; 286 }); 287}