about summary refs log tree commit diff
path: root/pkgs/applications/graphics/weylus/default.nix
blob: 0a238e87fac8bd0945bb21c7a867f8058da1ae45 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
{ lib
, stdenv
, rustPlatform
, fetchFromGitHub
, makeWrapper
, dbus
, ffmpeg
, x264
, libva
, gst_all_1
, xorg
, libdrm
, pkg-config
, pango
, pipewire
, cmake
, git
, autoconf
, libtool
, nodePackages
, ApplicationServices
, Carbon
, Cocoa
, VideoToolbox
}:

rustPlatform.buildRustPackage rec {
  pname = "weylus";
  version = "unstable-2022-06-07";

  src = fetchFromGitHub {
    owner = "H-M-H";
    repo = pname;
    rev = "b169a6be2bf3e8d105273d92f032cca5438de53a";
    sha256 = "sha256-J9eVFIfmyBviVuT1MYKb5yoacbPqOAT3A8jahWv5qw8=";
  };

  buildInputs = [
    ffmpeg
    x264
  ] ++ lib.optionals stdenv.isDarwin [
    ApplicationServices
    Carbon
    Cocoa
    VideoToolbox
  ] ++ lib.optionals stdenv.isLinux [
    dbus
    libva
    gst_all_1.gst-plugins-base
    xorg.libXext
    xorg.libXft
    xorg.libXinerama
    xorg.libXcursor
    xorg.libXrender
    xorg.libXfixes
    xorg.libXtst
    xorg.libXrandr
    xorg.libXcomposite
    xorg.libXi
    xorg.libXv
    pango
    libdrm
  ];

  nativeBuildInputs = [
    cmake
    git
    nodePackages.typescript
    makeWrapper
  ] ++ lib.optionals stdenv.isLinux [
    pkg-config
    autoconf
    libtool
  ];

  cargoSha256 = "sha256-R46RSRdtfqi1PRQ0MaSIIqtj+Pr3yikm6NeMwwu1CSw=";

  cargoBuildFlags = [ "--features=ffmpeg-system" ];
  cargoTestFlags = [ "--features=ffmpeg-system" ];

  postFixup = let
    GST_PLUGIN_PATH = lib.makeSearchPathOutput  "lib" "lib/gstreamer-1.0" [
      gst_all_1.gst-plugins-base
      pipewire
    ];
  in lib.optionalString stdenv.isLinux ''
    wrapProgram $out/bin/weylus --prefix GST_PLUGIN_PATH : ${GST_PLUGIN_PATH}
  '';

  postInstall = ''
    install -vDm755 weylus.desktop $out/share/applications/weylus.desktop
  '';

  meta = with lib; {
    broken = stdenv.isDarwin;
    description = "Use your tablet as graphic tablet/touch screen on your computer";
    homepage = "https://github.com/H-M-H/Weylus";
    license = with licenses; [ agpl3Only ];
    maintainers = with maintainers; [ lom ];
  };
}