summary refs log tree commit diff
diff options
context:
space:
mode:
authorlinsui <36977733+linsui@users.noreply.github.com>2022-03-08 12:56:51 +0000
committerGitHub <noreply@github.com>2022-03-08 13:56:51 +0100
commit73d9e53ff3c1458c79d61b588c93d005b2f36735 (patch)
treebc37779685f62a1c3826484f9a649a385bfc4653
parent14543803139758bf9f0d1eb6ce3c78bddd7b8a06 (diff)
downloadnixpkgs-73d9e53ff3c1458c79d61b588c93d005b2f36735.tar
nixpkgs-73d9e53ff3c1458c79d61b588c93d005b2f36735.tar.gz
nixpkgs-73d9e53ff3c1458c79d61b588c93d005b2f36735.tar.bz2
nixpkgs-73d9e53ff3c1458c79d61b588c93d005b2f36735.tar.lz
nixpkgs-73d9e53ff3c1458c79d61b588c93d005b2f36735.tar.xz
nixpkgs-73d9e53ff3c1458c79d61b588c93d005b2f36735.tar.zst
nixpkgs-73d9e53ff3c1458c79d61b588c93d005b2f36735.zip
weylus: build from source and fix desktop shortcut (#161052)
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
-rw-r--r--pkgs/applications/graphics/weylus/default.nix91
-rw-r--r--pkgs/top-level/all-packages.nix4
2 files changed, 56 insertions, 39 deletions
diff --git a/pkgs/applications/graphics/weylus/default.nix b/pkgs/applications/graphics/weylus/default.nix
index 092366652d4..7965f824125 100644
--- a/pkgs/applications/graphics/weylus/default.nix
+++ b/pkgs/applications/graphics/weylus/default.nix
@@ -1,64 +1,80 @@
 { 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
-    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; {
@@ -66,6 +82,5 @@ stdenv.mkDerivation rec {
     homepage = "https://github.com/H-M-H/Weylus";
     license = with licenses; [ agpl3Only ];
     maintainers = with maintainers; [ lom ];
-    platforms = [ "x86_64-linux" ];
   };
 }
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index f67784bbe43..57793651b10 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -1054,7 +1054,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 { };