Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 fetchpatch, 6 replaceVars, 7 meson, 8 nasm, 9 ninja, 10 pkg-config, 11 python3, 12 gst-plugins-base, 13 orc, 14 bzip2, 15 gettext, 16 libGL, 17 libv4l, 18 libdv, 19 libavc1394, 20 libiec61883, 21 libvpx, 22 libdrm, 23 speex, 24 opencore-amr, 25 flac, 26 taglib, 27 libshout, 28 cairo, 29 gdk-pixbuf, 30 aalib, 31 libcaca, 32 libsoup_3, 33 libpulseaudio, 34 libintl, 35 libxml2, 36 lame, 37 mpg123, 38 twolame, 39 gtkSupport ? false, 40 gtk3, 41 qt5Support ? false, 42 qt5, 43 qt6Support ? false, 44 qt6, 45 raspiCameraSupport ? false, 46 libraspberrypi, 47 enableJack ? true, 48 libjack2, 49 enableX11 ? stdenv.hostPlatform.isLinux, 50 xorg, 51 ncurses, 52 enableWayland ? stdenv.hostPlatform.isLinux, 53 wayland, 54 wayland-protocols, 55 libgudev, 56 wavpack, 57 glib, 58 openssl, 59 # Checks meson.is_cross_build(), so even canExecute isn't enough. 60 enableDocumentation ? stdenv.hostPlatform == stdenv.buildPlatform, 61 hotdoc, 62 gst-plugins-good, 63 directoryListingUpdater, 64 apple-sdk_gstreamer, 65}: 66 67let 68 # MMAL is not supported on aarch64, see: 69 # https://github.com/raspberrypi/userland/issues/688 70 hostSupportsRaspiCamera = stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch32; 71in 72 73assert raspiCameraSupport -> hostSupportsRaspiCamera; 74 75stdenv.mkDerivation (finalAttrs: { 76 pname = "gst-plugins-good"; 77 version = "1.26.0"; 78 79 outputs = [ 80 "out" 81 "dev" 82 ]; 83 84 src = fetchurl { 85 url = "https://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-${finalAttrs.version}.tar.xz"; 86 hash = "sha256-nhjxOe9prQhnwt+7j+HRc2123xGqyD9g6NOtseLq8Ds="; 87 }; 88 89 patches = [ 90 # dlopen libsoup_3 with an absolute path 91 (replaceVars ./souploader.diff { 92 nixLibSoup3Path = "${lib.getLib libsoup_3}/lib"; 93 }) 94 95 (fetchpatch { 96 name = "musl.patch"; 97 url = "https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/dd1fc2b7931f5789815e17dda2ef7c31b9fba563.patch"; 98 stripLen = 2; 99 hash = "sha256-m2h1F6M2hzw3HxizmCyEEqkUQe0ccLWFBvgT2f+GjNE="; 100 }) 101 ]; 102 103 strictDeps = true; 104 105 depsBuildBuild = [ pkg-config ]; 106 107 nativeBuildInputs = [ 108 pkg-config 109 python3 110 meson 111 ninja 112 gettext 113 nasm 114 orc 115 libshout 116 glib 117 ] 118 ++ lib.optionals enableDocumentation [ 119 hotdoc 120 ] 121 ++ lib.optionals qt5Support ( 122 with qt5; 123 [ 124 qtbase 125 qttools 126 ] 127 ) 128 ++ lib.optionals qt6Support ( 129 with qt6; 130 [ 131 qtbase 132 qttools 133 ] 134 ) 135 ++ lib.optionals enableWayland [ 136 wayland-protocols 137 ]; 138 139 buildInputs = [ 140 gst-plugins-base 141 orc 142 bzip2 143 libdv 144 libvpx 145 speex 146 opencore-amr 147 flac 148 taglib 149 cairo 150 gdk-pixbuf 151 aalib 152 libcaca 153 libsoup_3 154 libshout 155 libxml2 156 lame 157 mpg123 158 twolame 159 libintl 160 ncurses 161 wavpack 162 openssl 163 ] 164 ++ lib.optionals raspiCameraSupport [ 165 libraspberrypi 166 ] 167 ++ lib.optionals enableX11 [ 168 xorg.libXext 169 xorg.libXfixes 170 xorg.libXdamage 171 xorg.libXtst 172 xorg.libXi 173 ] 174 ++ lib.optionals gtkSupport [ 175 # for gtksink 176 gtk3 177 ] 178 ++ lib.optionals qt5Support ( 179 with qt5; 180 [ 181 qtbase 182 qtdeclarative 183 qtwayland 184 qtx11extras 185 ] 186 ) 187 ++ lib.optionals qt6Support ( 188 with qt6; 189 [ 190 qtbase 191 qtdeclarative 192 qtwayland 193 ] 194 ) 195 ++ lib.optionals stdenv.hostPlatform.isLinux [ 196 libdrm 197 libGL 198 libv4l 199 libpulseaudio 200 libavc1394 201 libiec61883 202 libgudev 203 ] 204 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 205 apple-sdk_gstreamer 206 ] 207 ++ lib.optionals enableWayland [ 208 wayland 209 ] 210 ++ lib.optionals enableJack [ 211 libjack2 212 ]; 213 214 mesonFlags = [ 215 "-Dexamples=disabled" # requires many dependencies and probably not useful for our users 216 "-Dglib_debug=disabled" # cast checks should be disabled on stable releases 217 (lib.mesonEnable "doc" enableDocumentation) 218 ] 219 ++ lib.optionals (!qt5Support) [ 220 "-Dqt5=disabled" 221 ] 222 ++ lib.optionals (!qt6Support) [ 223 "-Dqt6=disabled" 224 ] 225 ++ lib.optionals (!gtkSupport) [ 226 "-Dgtk3=disabled" 227 ] 228 ++ lib.optionals (!enableX11) [ 229 "-Dximagesrc=disabled" # Linux-only 230 ] 231 ++ lib.optionals (!enableJack) [ 232 "-Djack=disabled" 233 ] 234 ++ lib.optionals (!stdenv.hostPlatform.isLinux) [ 235 "-Ddv1394=disabled" # Linux only 236 "-Doss4=disabled" # Linux only 237 "-Doss=disabled" # Linux only 238 "-Dpulse=disabled" # TODO check if we can keep this enabled 239 "-Dv4l2-gudev=disabled" # Linux-only 240 "-Dv4l2=disabled" # Linux-only 241 ] 242 ++ ( 243 if raspiCameraSupport then 244 [ 245 "-Drpi-lib-dir=${libraspberrypi}/lib" 246 ] 247 else 248 [ 249 "-Drpicamsrc=disabled" 250 ] 251 ); 252 253 postPatch = '' 254 patchShebangs \ 255 scripts/extract-release-date-from-doap-file.py \ 256 ext/qt6/qsb-wrapper.py 257 ''; 258 259 env = { 260 NIX_LDFLAGS = 261 # linking error on Darwin 262 # https://github.com/NixOS/nixpkgs/pull/70690#issuecomment-553694896 263 "-lncurses"; 264 }; 265 266 # fails 1 tests with "Unexpected critical/warning: g_object_set_is_valid_property: object class 'GstRtpStorage' has no property named ''" 267 doCheck = false; 268 269 # must be explicitly set since 5590e365 270 dontWrapQtApps = true; 271 272 passthru = { 273 tests = { 274 gtk = gst-plugins-good.override { 275 gtkSupport = true; 276 }; 277 qt5 = gst-plugins-good.override { 278 qt5Support = true; 279 }; 280 qt6 = gst-plugins-good.override { 281 qt6Support = true; 282 }; 283 } 284 // lib.optionalAttrs hostSupportsRaspiCamera { 285 raspiCamera = gst-plugins-good.override { 286 raspiCameraSupport = true; 287 }; 288 }; 289 290 updateScript = directoryListingUpdater { }; 291 }; 292 293 meta = with lib; { 294 description = "GStreamer Good Plugins"; 295 homepage = "https://gstreamer.freedesktop.org"; 296 longDescription = '' 297 a set of plug-ins that we consider to have good quality code, 298 correct functionality, our preferred license (LGPL for the plug-in 299 code, LGPL or LGPL-compatible for the supporting library). 300 ''; 301 license = licenses.lgpl2Plus; 302 platforms = platforms.linux ++ platforms.darwin; 303 maintainers = with maintainers; [ matthewbauer ]; 304 }; 305})