Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchzip, 5 fetchFromGitHub, 6 makeWrapper, 7 autoPatchelfHook, 8 patchelfUnstable, 9 fetchpatch, 10 libjxl, 11 brotli, 12 at-spi2-atk, 13 cairo, 14 flite, 15 fontconfig, 16 freetype, 17 glib, 18 glib-networking, 19 gst_all_1, 20 harfbuzz, 21 harfbuzzFull, 22 icu70, 23 lcms, 24 libavif, 25 libdrm, 26 libepoxy, 27 libevent, 28 libgcc, 29 libgcrypt, 30 libgpg-error, 31 libjpeg8, 32 libopus, 33 libpng, 34 libsoup_3, 35 libtasn1, 36 libvpx, 37 libwebp, 38 libwpe, 39 libwpe-fdo, 40 libxkbcommon, 41 libxml2, 42 libxslt, 43 libgbm, 44 sqlite, 45 systemdLibs, 46 wayland-scanner, 47 woff2, 48 zlib, 49 suffix, 50 revision, 51 system, 52 throwSystem, 53}: 54let 55 suffix' = 56 if lib.hasPrefix "linux" suffix then 57 "ubuntu-22.04" + (lib.removePrefix "linux" suffix) 58 else if lib.hasPrefix "mac" suffix then 59 "mac-14" + (lib.removePrefix "mac" suffix) 60 else 61 suffix; 62 libvpx' = libvpx.overrideAttrs ( 63 finalAttrs: previousAttrs: { 64 version = "1.12.0"; 65 src = fetchFromGitHub { 66 owner = "webmproject"; 67 repo = finalAttrs.pname; 68 rev = "v${finalAttrs.version}"; 69 sha256 = "sha256-9SFFE2GfYYMgxp1dpmL3STTU2ea1R5vFKA1L0pZwIvQ="; 70 }; 71 } 72 ); 73 libavif' = libavif.overrideAttrs ( 74 finalAttrs: previousAttrs: { 75 version = "0.9.3"; 76 src = fetchFromGitHub { 77 owner = "AOMediaCodec"; 78 repo = finalAttrs.pname; 79 rev = "v${finalAttrs.version}"; 80 hash = "sha256-ME/mkaHhFeHajTbc7zhg9vtf/8XgkgSRu9I/mlQXnds="; 81 }; 82 postPatch = ""; 83 patches = [ ]; 84 } 85 ); 86 87 libjxl' = libjxl.overrideAttrs ( 88 finalAttrs: previousAttrs: { 89 version = "0.8.2"; 90 src = fetchFromGitHub { 91 owner = "libjxl"; 92 repo = "libjxl"; 93 rev = "v${finalAttrs.version}"; 94 hash = "sha256-I3PGgh0XqRkCFz7lUZ3Q4eU0+0GwaQcVb6t4Pru1kKo="; 95 fetchSubmodules = true; 96 }; 97 patches = [ 98 # Add missing <atomic> content to fix gcc compilation for RISCV architecture 99 # https://github.com/libjxl/libjxl/pull/2211 100 (fetchpatch { 101 url = "https://github.com/libjxl/libjxl/commit/22d12d74e7bc56b09cfb1973aa89ec8d714fa3fc.patch"; 102 hash = "sha256-X4fbYTMS+kHfZRbeGzSdBW5jQKw8UN44FEyFRUtw0qo="; 103 }) 104 ]; 105 postPatch = '' 106 # Fix multiple definition errors by using C++17 instead of C++11 107 substituteInPlace CMakeLists.txt \ 108 --replace "set(CMAKE_CXX_STANDARD 11)" "set(CMAKE_CXX_STANDARD 17)" 109 ''; 110 postInstall = ""; 111 112 cmakeFlags = [ 113 "-DJPEGXL_FORCE_SYSTEM_BROTLI=ON" 114 "-DJPEGXL_FORCE_SYSTEM_HWY=ON" 115 "-DJPEGXL_FORCE_SYSTEM_GTEST=ON" 116 ] 117 ++ lib.optionals stdenv.hostPlatform.isStatic [ 118 "-DJPEGXL_STATIC=ON" 119 ] 120 ++ lib.optionals stdenv.hostPlatform.isAarch32 [ 121 "-DJPEGXL_FORCE_NEON=ON" 122 ]; 123 } 124 ); 125 webkit-linux = stdenv.mkDerivation { 126 name = "playwright-webkit"; 127 src = fetchzip { 128 url = "https://playwright.azureedge.net/builds/webkit/${revision}/webkit-${suffix'}.zip"; 129 stripRoot = false; 130 hash = 131 { 132 x86_64-linux = "sha256-OSVHFGdcQrzmhLPdXF61tKmip/6/D+uaQgSBBQiOIZI="; 133 aarch64-linux = "sha256-b8XwVMCwSbujyqgkJKIPAVNX83Qmmsthprr2x9XSb10="; 134 } 135 .${system} or throwSystem; 136 }; 137 138 nativeBuildInputs = [ 139 autoPatchelfHook 140 patchelfUnstable 141 makeWrapper 142 ]; 143 buildInputs = [ 144 at-spi2-atk 145 cairo 146 flite 147 fontconfig.lib 148 freetype 149 glib 150 brotli 151 libjxl' 152 gst_all_1.gst-plugins-bad 153 gst_all_1.gst-plugins-base 154 gst_all_1.gstreamer 155 harfbuzz 156 harfbuzzFull 157 icu70 158 lcms 159 libavif' 160 libdrm 161 libepoxy 162 libevent 163 libgcc.lib 164 libgcrypt 165 libgpg-error 166 libjpeg8 167 libopus 168 libpng 169 libsoup_3 170 libtasn1 171 libwebp 172 libwpe 173 libwpe-fdo 174 libvpx' 175 libxml2 176 libxslt 177 libgbm 178 sqlite 179 systemdLibs 180 wayland-scanner 181 woff2.lib 182 libxkbcommon 183 zlib 184 ]; 185 186 patchelfFlags = [ "--no-clobber-old-sections" ]; 187 buildPhase = '' 188 cp -R . $out 189 190 # remove unused gtk browser 191 rm -rf $out/minibrowser-gtk 192 # remove bundled libs 193 rm -rf $out/minibrowser-wpe/sys 194 195 # TODO: still fails on ubuntu trying to find libEGL_mesa.so.0 196 wrapProgram $out/minibrowser-wpe/bin/MiniBrowser \ 197 --prefix GIO_EXTRA_MODULES ":" "${glib-networking}/lib/gio/modules/" \ 198 --prefix LD_LIBRARY_PATH ":" $out/minibrowser-wpe/lib 199 200 ''; 201 202 preFixup = '' 203 # Fix libxml2 breakage. See https://github.com/NixOS/nixpkgs/pull/396195#issuecomment-2881757108 204 mkdir -p "$out/lib" 205 ln -s "${lib.getLib libxml2}/lib/libxml2.so" "$out/lib/libxml2.so.2" 206 ''; 207 }; 208 webkit-darwin = fetchzip { 209 url = "https://playwright.azureedge.net/builds/webkit/${revision}/webkit-${suffix'}.zip"; 210 stripRoot = false; 211 hash = 212 { 213 x86_64-darwin = "sha256-shjhozJS2VbBjpjJVlM9hwBzGWwgva1qhfEUhY8t9Bk="; 214 aarch64-darwin = "sha256-ZRl86L/OOTNPWfZDl6JQfuXL41kI/Wir99/JIbf7T7M="; 215 } 216 .${system} or throwSystem; 217 }; 218in 219{ 220 x86_64-linux = webkit-linux; 221 aarch64-linux = webkit-linux; 222 x86_64-darwin = webkit-darwin; 223 aarch64-darwin = webkit-darwin; 224} 225.${system} or throwSystem