diff --git a/pkgs/by-name/li/livekit-libwebrtc/package.nix b/pkgs/by-name/li/livekit-libwebrtc/package.nix index 69bf213bc4535..d452bc54e5e1c 100644 --- a/pkgs/by-name/li/livekit-libwebrtc/package.nix +++ b/pkgs/by-name/li/livekit-libwebrtc/package.nix @@ -147,6 +147,11 @@ stdenv.mkDerivation { substituteInPlace build/toolchain/apple/toolchain.gni --replace-fail "/bin/cp -Rc" "cp -a" ''; + outputs = [ + "dev" + "out" + ]; + nativeBuildInputs = (builtins.concatLists ( lib.mapAttrsToList ( @@ -249,24 +254,24 @@ stdenv.mkDerivation { '' runHook preInstall - mkdir -p $out/{lib,include} - cp obj/webrtc.ninja $out/ - cp args.gn $out/ - cp LICENSE.md $out/ + mkdir -p $out/lib + mkdir -p $dev/include + + install -m0644 obj/webrtc.ninja args.gn LICENSE.md $dev + + pushd ../.. + find . -name "*.h" -print | cpio -pd $dev/include + popd '' + lib.optionalString stdenv.hostPlatform.isLinux '' - cp libwebrtc.so $out/lib/ - cp libthird_party_boringssl.so $out/lib/ + install -m0644 libwebrtc.so libthird_party_boringssl.so $out/lib '' + lib.optionalString stdenv.hostPlatform.isDarwin '' - mkdir -p $out/Library/Frameworks - cp -r WebRTC.framework $out/Library/Frameworks - cp libwebrtc.dylib $out/lib - cp libthird_party_boringssl.dylib $out/lib/ + install -m0644 WebRTC.framework/Versions/A/WebRTC $out/lib/libwebrtc.dylib + install -m0644 libthird_party_boringssl.dylib $out/lib '' + '' - cd ../.. - find . -name "*.h" -print | cpio -pd $out/include + ln -s $out/lib $dev/lib runHook postInstall ''; @@ -274,13 +279,10 @@ stdenv.mkDerivation { postFixup = lib.optionalString stdenv.hostPlatform.isDarwin '' boringssl="$out/lib/libthird_party_boringssl.dylib" webrtc="$out/lib/libwebrtc.dylib" - framework="$out/Library/Frameworks/WebRTC.framework/Versions/A/WebRTC" install_name_tool -id "$boringssl" "$boringssl" install_name_tool -id "$webrtc" "$webrtc" install_name_tool -change @rpath/libthird_party_boringssl.dylib "$boringssl" "$webrtc" - install_name_tool -id "$framework" "$framework" - install_name_tool -change @rpath/libthird_party_boringssl.dylib "$boringssl" "$framework" ''; passthru.updateScript = writeShellScript "update-livekit-libwebrtc" '' diff --git a/pkgs/by-name/ze/zed-editor/package.nix b/pkgs/by-name/ze/zed-editor/package.nix index 414f93c9e45a3..1c6d977b76584 100644 --- a/pkgs/by-name/ze/zed-editor/package.nix +++ b/pkgs/by-name/ze/zed-editor/package.nix @@ -112,20 +112,11 @@ rustPlatform.buildRustPackage rec { "script/patches/use-cross-platform-livekit.patch" ]; - postPatch = - lib.optionalString stdenv.hostPlatform.isLinux '' - # Dynamically link WebRTC instead of static - substituteInPlace ../${pname}-${version}-vendor/webrtc-sys-*/build.rs \ - --replace-fail "cargo:rustc-link-lib=static=webrtc" "cargo:rustc-link-lib=dylib=webrtc" - '' - + lib.optionalString stdenv.hostPlatform.isDarwin '' - # On Darwin, linking against the dylib results in Rust linker errors, while - # linking against the framework works fine. - substituteInPlace ../${pname}-${version}-vendor/webrtc-sys-*/build.rs \ - --replace-fail "cargo:rustc-link-lib=static=webrtc" "cargo:rustc-link-lib=framework=webrtc" \ - --replace-fail 'println!("cargo:rustc-link-search=native={}", webrtc_lib.to_str().unwrap());' \ - 'println!("cargo:rustc-link-search=framework={}/Library/Frameworks", webrtc_dir.to_str().unwrap());' - ''; + # Dynamically link WebRTC instead of static + postPatch = '' + substituteInPlace ../${pname}-${version}-vendor/webrtc-sys-*/build.rs \ + --replace-fail "cargo:rustc-link-lib=static=webrtc" "cargo:rustc-link-lib=dylib=webrtc" + ''; useFetchCargoVendor = true; cargoHash = "sha256-J5vJ/KV94a+9AqGbNZx6sCzWflOZsyUj3NcqnfaexGE="; @@ -297,6 +288,16 @@ rustPlatform.buildRustPackage rec { versionCheckProgramArg = [ "--version" ]; doInstallCheck = true; + # The darwin Applications directory is not stripped by default, see + # https://github.com/NixOS/nixpkgs/issues/367169 + # This setting is not platform-guarded as it doesn't do any harm on Linux, + # where this directory simply does not exist. + stripDebugList = [ + "bin" + "libexec" + "Applications" + ]; + passthru = { updateScript = gitUpdater { rev-prefix = "v";