From 406de7fdc30979f745f6a0747d16985a5cd811c5 Mon Sep 17 00:00:00 2001 From: comex Date: Sat, 11 Nov 2023 11:29:20 -0800 Subject: [PATCH] libass: enable CoreText backend on darwin libass has multiple font rendering backends which are autodetected by the configure script. On macOS, there is a CoreText backend, but it was disabled in Nix's build because the relevant native frameworks weren't visible to the configure script. Fix that. --- nixos/doc/manual/release-notes/rl-2311.section.md | 2 ++ pkgs/development/libraries/libass/default.nix | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/nixos/doc/manual/release-notes/rl-2311.section.md b/nixos/doc/manual/release-notes/rl-2311.section.md index d838d33e35dc..e04e054865c2 100644 --- a/nixos/doc/manual/release-notes/rl-2311.section.md +++ b/nixos/doc/manual/release-notes/rl-2311.section.md @@ -519,6 +519,8 @@ The module update takes care of the new config syntax and the data itself (user - The Home Assistant module now offers support for installing custom components and lovelace modules. Available at [`services.home-assistant.customComponents`](#opt-services.home-assistant.customComponents) and [`services.home-assistant.customLovelaceModules`](#opt-services.home-assistant.customLovelaceModules). +- `libass` now uses the native CoreText backend on Darwin, which may fix subtitle rendering issues with `mpv`, `ffmpeg`, etc. + ## Nixpkgs internals {#sec-release-23.11-nixpkgs-internals} - The use of `sourceRoot = "source";`, `sourceRoot = "source/subdir";`, and similar lines in package derivations using the default `unpackPhase` is deprecated as it requires `unpackPhase` to always produce a directory named "source". Use `sourceRoot = src.name`, `sourceRoot = "${src.name}/subdir";`, or `setSourceRoot = "sourceRoot=$(echo */subdir)";` or similar instead. diff --git a/pkgs/development/libraries/libass/default.nix b/pkgs/development/libraries/libass/default.nix index 3265fd7d093e..ad94f55ccb6d 100644 --- a/pkgs/development/libraries/libass/default.nix +++ b/pkgs/development/libraries/libass/default.nix @@ -4,6 +4,7 @@ , rasterizerSupport ? false # Internal rasterizer , largeTilesSupport ? false # Use larger tiles in the rasterizer , libiconv +, darwin }: assert fontconfigSupport -> fontconfig != null; @@ -29,7 +30,12 @@ stdenv.mkDerivation rec { buildInputs = [ freetype fribidi harfbuzz ] ++ lib.optional fontconfigSupport fontconfig - ++ lib.optional stdenv.isDarwin libiconv; + ++ lib.optional stdenv.isDarwin [ + libiconv + darwin.apple_sdk.frameworks.ApplicationServices + darwin.apple_sdk.frameworks.CoreFoundation + darwin.apple_sdk.frameworks.CoreText + ]; meta = with lib; { description = "Portable ASS/SSA subtitle renderer";