From 481fe0b915f5bf922eeda4613e1711c578bb86c9 Mon Sep 17 00:00:00 2001 From: Sizhe Zhao Date: Sat, 21 Jun 2025 17:03:11 +0800 Subject: [PATCH 1/2] presenterm: fix linking to libsixel on darwin --- pkgs/by-name/pr/presenterm/package.nix | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/pr/presenterm/package.nix b/pkgs/by-name/pr/presenterm/package.nix index fe868c832eb9..027a02aa9981 100644 --- a/pkgs/by-name/pr/presenterm/package.nix +++ b/pkgs/by-name/pr/presenterm/package.nix @@ -3,6 +3,7 @@ stdenv, rustPlatform, fetchFromGitHub, + makeBinaryWrapper, lld, libsixel, versionCheckHook, @@ -20,9 +21,13 @@ rustPlatform.buildRustPackage (finalAttrs: { hash = "sha256-vBEHk0gQe4kUTtH4qtc0jVfDvYGabnkJrwPxmxt10hs="; }; - nativeBuildInputs = lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [ - lld - ]; + nativeBuildInputs = + lib.optionals stdenv.hostPlatform.isDarwin [ + makeBinaryWrapper + ] + ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [ + lld + ]; buildInputs = [ libsixel @@ -48,6 +53,12 @@ rustPlatform.buildRustPackage (finalAttrs: { "--skip=external_snippet" ]; + # sixel-sys is dynamically linked to libsixel + postInstall = lib.optionalString stdenv.hostPlatform.isDarwin '' + wrapProgram $out/bin/presenterm \ + --prefix DYLD_LIBRARY_PATH : "${lib.makeLibraryPath [ libsixel ]}" + ''; + nativeInstallCheckInputs = [ versionCheckHook ]; From ee9ecc47d8240bd88dd4cd15de36266460e71ce5 Mon Sep 17 00:00:00 2001 From: Sizhe Zhao Date: Sat, 21 Jun 2025 17:05:01 +0800 Subject: [PATCH 2/2] presenterm: refactor --- pkgs/by-name/pr/presenterm/package.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkgs/by-name/pr/presenterm/package.nix b/pkgs/by-name/pr/presenterm/package.nix index 027a02aa9981..3e270de606b9 100644 --- a/pkgs/by-name/pr/presenterm/package.nix +++ b/pkgs/by-name/pr/presenterm/package.nix @@ -9,7 +9,9 @@ versionCheckHook, nix-update-script, }: - +let + inherit (stdenv.hostPlatform) isDarwin isx86_64; +in rustPlatform.buildRustPackage (finalAttrs: { pname = "presenterm"; version = "0.14.0"; @@ -22,10 +24,10 @@ rustPlatform.buildRustPackage (finalAttrs: { }; nativeBuildInputs = - lib.optionals stdenv.hostPlatform.isDarwin [ + lib.optionals isDarwin [ makeBinaryWrapper ] - ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [ + ++ lib.optionals (isDarwin && isx86_64) [ lld ]; @@ -40,7 +42,7 @@ rustPlatform.buildRustPackage (finalAttrs: { useFetchCargoVendor = true; cargoHash = "sha256-u0wOWKAfzi1Fxmx6x2ckrIv/PKgtqKrDiDauD4/BY24="; - env = lib.optionalAttrs (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) { + env = lib.optionalAttrs (isDarwin && isx86_64) { NIX_CFLAGS_LINK = "-fuse-ld=lld"; }; @@ -54,7 +56,7 @@ rustPlatform.buildRustPackage (finalAttrs: { ]; # sixel-sys is dynamically linked to libsixel - postInstall = lib.optionalString stdenv.hostPlatform.isDarwin '' + postInstall = lib.optionalString isDarwin '' wrapProgram $out/bin/presenterm \ --prefix DYLD_LIBRARY_PATH : "${lib.makeLibraryPath [ libsixel ]}" '';