1{
2 lib,
3 stdenv,
4 rustPlatform,
5 fetchFromGitHub,
6 makeBinaryWrapper,
7 lld,
8 libsixel,
9 versionCheckHook,
10 nix-update-script,
11}:
12let
13 inherit (stdenv.hostPlatform) isDarwin isx86_64;
14in
15rustPlatform.buildRustPackage (finalAttrs: {
16 pname = "presenterm";
17 version = "0.15.0";
18
19 src = fetchFromGitHub {
20 owner = "mfontanini";
21 repo = "presenterm";
22 tag = "v${finalAttrs.version}";
23 hash = "sha256-6ziPuWbPOsSwlnqVN1cKaOvxVk3axFnPBsnCIZz2iTg=";
24 };
25
26 nativeBuildInputs =
27 lib.optionals isDarwin [
28 makeBinaryWrapper
29 ]
30 ++ lib.optionals (isDarwin && isx86_64) [
31 lld
32 ];
33
34 buildInputs = [
35 libsixel
36 ];
37
38 buildFeatures = [
39 "sixel"
40 ];
41
42 cargoHash = "sha256-UOPX5+RnnAStrsvBbL211m5NzYFjqbpIG/sdvoej1Rc=";
43
44 env = lib.optionalAttrs (isDarwin && isx86_64) {
45 NIX_CFLAGS_LINK = "-fuse-ld=lld";
46 };
47
48 checkFeatures = [
49 "sixel"
50 ];
51
52 checkFlags = [
53 # failed to load .tmpEeeeaQ: No such file or directory (os error 2)
54 "--skip=external_snippet"
55 ];
56
57 # sixel-sys is dynamically linked to libsixel
58 postInstall = lib.optionalString isDarwin ''
59 wrapProgram $out/bin/presenterm \
60 --prefix DYLD_LIBRARY_PATH : "${lib.makeLibraryPath [ libsixel ]}"
61 '';
62
63 nativeInstallCheckInputs = [
64 versionCheckHook
65 ];
66 versionCheckProgramArg = "--version";
67 doInstallCheck = true;
68
69 passthru = {
70 updateScript = nix-update-script { };
71 };
72
73 meta = {
74 description = "Terminal based slideshow tool";
75 changelog = "https://github.com/mfontanini/presenterm/releases/tag/v${finalAttrs.version}";
76 homepage = "https://github.com/mfontanini/presenterm";
77 license = lib.licenses.bsd2;
78 maintainers = with lib.maintainers; [ mikaelfangel ];
79 mainProgram = "presenterm";
80 };
81})