Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

weylus: build from source and fix desktop shortcut #161052

Merged
merged 2 commits into from
Mar 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 53 additions & 38 deletions pkgs/applications/graphics/weylus/default.nix
Original file line number Diff line number Diff line change
@@ -1,71 +1,86 @@
{ lib
, dbus
, stdenv
, rustPlatform
, fetchFromGitHub
, dbus
, ffmpeg
, x264
, libva
, gst_all_1
, xorg
, libdrm
, libva
, fetchzip
, copyDesktopItems
, fontconfig
, libpng
, pipewire
, makeWrapper
, autoPatchelfHook
, pkg-config
, pango
, cmake
, autoconf
, libtool
, nodePackages
, ApplicationServices
, Carbon
, Cocoa
, VideoToolbox
}:

stdenv.mkDerivation rec {
rustPlatform.buildRustPackage rec {
pname = "weylus";
version = "0.11.4";

src = fetchzip {
url = "https://github.com/H-M-H/Weylus/releases/download/v${version}/linux.zip";
sha256 = "sha256-EW3TdI4F4d4X/BeSqI05QtS77ym1U5jdswFfNtSFyFk=";
stripRoot = false;
src = fetchFromGitHub {
owner = "H-M-H";
repo = pname;
rev = "v${version}";
sha256 = "0gq2czxvahww97j4i3k18np29zl6wx85f8253wn3ibqrpfnklz6l";
};

installPhase = ''
runHook preInstall
install -Dm755 ./weylus $out/bin/weylus
copyDesktopItems ./weylus.desktop
runHook postInstall
'';

buildInputs = [
libpng
ffmpeg
x264
] ++ lib.optionals stdenv.isDarwin [
ApplicationServices
Carbon
Cocoa
VideoToolbox
] ++ lib.optionals stdenv.isLinux [
dbus
libdrm
fontconfig
libva
gst_all_1.gst-plugins-base
pipewire
# autoPatchelfHook complains if these are missing, even on wayland
xorg.libXext
xorg.libXft
xorg.libXinerama
xorg.libXcursor
xorg.libXrender
xorg.libXfixes
xorg.libXtst
xorg.libXrandr
xorg.libXcomposite
xorg.libXtst
xorg.libXi
xorg.libXv
pango
libdrm
];

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

cargoSha256 = "1pigmch0sy9ipsafd83b8q54xwqjxdaif363n1q8n46arq4v81j0";

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

postFixup = let
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GST_PLUGIN_PATH is still required (H-M-H/Weylus#155 (comment)). I've opened #174434 to re-add it on Linux.

GST_PLUGIN_PATH = lib.makeSearchPathOutput "lib" "lib/gstreamer-1.0" [
gst_all_1.gst-plugins-base
pipewire
];
in ''
wrapProgram $out/bin/weylus --prefix GST_PLUGIN_PATH : ${GST_PLUGIN_PATH}
postInstall = ''
install -vDm755 weylus.desktop $out/share/applications/weylus.desktop
'';

meta = with lib; {
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 ];
platforms = [ "x86_64-linux" ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It currently is not building on darwin because libva -> libdrm -> libpciaccess which does not build on darwin. I don't think we should fix this blind. Not sure if you want to keep it like it is or change something.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, libva is only used on linux. H-M-H/Weylus@b47e5f2

};
}
4 changes: 3 additions & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,9 @@ with pkgs;

weidu = callPackage ../tools/games/weidu { };

weylus = callPackage ../applications/graphics/weylus { };
weylus = callPackage ../applications/graphics/weylus {
inherit (darwin.apple_sdk.frameworks) ApplicationServices Carbon Cocoa VideoToolbox;
};

gfshare = callPackage ../tools/security/gfshare { };

Expand Down