presenterm: fix linking to libsixel on darwin & refactor (#418671)

This commit is contained in:
Gaétan Lepage
2025-06-21 11:31:44 +02:00
committed by GitHub
+18 -5
View File
@@ -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
];