Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 73 lines 1.8 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 gst_all_1, 6 pkg-config, 7 meson, 8 ninja, 9 obs-studio, 10}: 11 12stdenv.mkDerivation rec { 13 pname = "obs-gstreamer"; 14 version = "0.4.1"; 15 16 src = fetchFromGitHub { 17 owner = "fzwoch"; 18 repo = pname; 19 rev = "v${version}"; 20 hash = "sha256-23LyxN1Vgol9uA7rDdfZXcmfhG4l0RfMYGbofbhObBE="; 21 }; 22 23 postPatch = '' 24 substituteInPlace meson.build \ 25 --replace-fail "'git', 'rev-parse', '--short', 'HEAD'" "'echo', '${version}'" 26 ''; 27 28 nativeBuildInputs = [ 29 pkg-config 30 meson 31 ninja 32 ]; 33 buildInputs = with gst_all_1; [ 34 gstreamer 35 gst-plugins-base 36 obs-studio 37 ]; 38 39 # - We need "getLib" instead of default derivation, otherwise it brings gstreamer-bin; 40 # - without gst-plugins-base it won't even show proper errors in logs; 41 # - Without gst-plugins-bad it won't find element "h264parse"; 42 # - gst-plugins-ugly adds "x264" to "Encoder type"; 43 # Tip: "could not link appsrc to videoconvert1" can mean a lot of things, enable GST_DEBUG=2 for help. 44 passthru.obsWrapperArguments = 45 let 46 gstreamerHook = 47 package: "--prefix GST_PLUGIN_SYSTEM_PATH_1_0 : ${lib.getLib package}/lib/gstreamer-1.0"; 48 in 49 with gst_all_1; 50 builtins.map gstreamerHook [ 51 gstreamer 52 gst-plugins-base 53 gst-plugins-bad 54 gst-plugins-ugly 55 ]; 56 57 # Fix output directory 58 postInstall = '' 59 mkdir $out/lib/obs-plugins 60 mv $out/lib/obs-gstreamer.so $out/lib/obs-plugins/ 61 ''; 62 63 meta = with lib; { 64 description = "OBS Studio source, encoder and video filter plugin to use GStreamer elements/pipelines in OBS Studio"; 65 homepage = "https://github.com/fzwoch/obs-gstreamer"; 66 maintainers = with maintainers; [ 67 ahuzik 68 pedrohlc 69 ]; 70 license = licenses.gpl2Plus; 71 platforms = platforms.linux; 72 }; 73}