diff --git a/pkgs/by-name/pr/presenterm/package.nix b/pkgs/by-name/pr/presenterm/package.nix index fe868c832eb9..3e270de606b9 100644 --- a/pkgs/by-name/pr/presenterm/package.nix +++ b/pkgs/by-name/pr/presenterm/package.nix @@ -3,12 +3,15 @@ stdenv, rustPlatform, fetchFromGitHub, + makeBinaryWrapper, lld, libsixel, versionCheckHook, nix-update-script, }: - +let + inherit (stdenv.hostPlatform) isDarwin isx86_64; +in rustPlatform.buildRustPackage (finalAttrs: { pname = "presenterm"; version = "0.14.0"; @@ -20,9 +23,13 @@ rustPlatform.buildRustPackage (finalAttrs: { hash = "sha256-vBEHk0gQe4kUTtH4qtc0jVfDvYGabnkJrwPxmxt10hs="; }; - nativeBuildInputs = lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [ - lld - ]; + nativeBuildInputs = + lib.optionals isDarwin [ + makeBinaryWrapper + ] + ++ lib.optionals (isDarwin && isx86_64) [ + lld + ]; buildInputs = [ libsixel @@ -35,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"; }; @@ -48,6 +55,12 @@ rustPlatform.buildRustPackage (finalAttrs: { "--skip=external_snippet" ]; + # sixel-sys is dynamically linked to libsixel + postInstall = lib.optionalString isDarwin '' + wrapProgram $out/bin/presenterm \ + --prefix DYLD_LIBRARY_PATH : "${lib.makeLibraryPath [ libsixel ]}" + ''; + nativeInstallCheckInputs = [ versionCheckHook ];