Andreas Schaafsma bd75aecb14 bla
2025-07-15 03:45:46 +02:00

106 lines
3.6 KiB
Nix

{ lib, pkgs, inputs ? null, ... }:
pkgs.kdePackages.mkKdeDerivation rec {
pname = "wallpaper-engine-plugin";
version = "unstable-2023-07-01";
src = if inputs != null && inputs ? wallpaper-engine-plugin-src
then inputs.wallpaper-engine-plugin-src
else pkgs.fetchFromGitHub {
owner = "catsout";
repo = "wallpaper-engine-kde-plugin";
rev = "9e60b364e268814a1a778549c579ad45a9b9c7bb";
sha256 = "sha256-tKeYJvVa8jzbyZ7MQaOuCUJa+UqABolTNe3e5XNw998=";
fetchSubmodules = true;
};
extraNativeBuildInputs = [
pkgs.kdePackages.kpackage
pkgs.pkg-config
(pkgs.python3.withPackages (ps: with ps; [ websockets ]))
];
extraBuildInputs = [
pkgs.kdePackages.extra-cmake-modules
pkgs.kdePackages.libplasma
pkgs.lz4
pkgs.mpv
pkgs.libass
pkgs.libsysprof-capture
pkgs.fribidi
pkgs.ffmpeg
pkgs.libplacebo
pkgs.libunwind
pkgs.shaderc
pkgs.lcms2
pkgs.libdovi
pkgs.libdvdnav
pkgs.libdvdread
pkgs.vulkan-headers
pkgs.vulkan-loader
pkgs.spirv-tools
pkgs.gst_all_1.gstreamer
pkgs.gst_all_1.gst-plugins-base
pkgs.gst_all_1.gst-plugins-good
pkgs.gst_all_1.gst-plugins-bad
pkgs.gst_all_1.gst-plugins-ugly
pkgs.gst_all_1.gst-libav
pkgs.mujs
];
# Disable the scene backend since it's missing CMakeLists.txt
postPatch = ''
sed -i 's|add_subdirectory(backend_scene)|# add_subdirectory(backend_scene)|' src/CMakeLists.txt
# Remove wescene-renderer-qml library link dependency
sed -i 's|wescene-renderer-qml|# wescene-renderer-qml|' src/CMakeLists.txt
# Remove SceneBackend dependencies from PluginInfo.cpp
sed -i '/^#include "SceneBackend.hpp"/d' src/PluginInfo.cpp
sed -i 's|QString::fromStdString(scenebackend::SceneObject::GetDefaultCachePath())|QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/wallpaper-engine-kde-plugin"|' src/PluginInfo.cpp
# Add missing includes to PluginInfo.cpp
sed -i '/#include <QCoreApplication>/a #include <QStandardPaths>' src/PluginInfo.cpp
sed -i '/#include <QCoreApplication>/a #include <QUrl>' src/PluginInfo.cpp
# Remove SceneBackend dependencies from plugin.cpp
sed -i '/^#include "SceneBackend.hpp"/d' src/plugin.cpp
sed -i '/qmlRegisterType<scenebackend::SceneObject>/d' src/plugin.cpp
# Fix Qt6 deprecation warnings in MouseGrabber.cpp
sed -i 's|event->localPos()|event->position()|g' src/MouseGrabber.cpp
sed -i 's|event->screenPos()|event->globalPosition()|g' src/MouseGrabber.cpp
sed -i 's|event->posF()|event->position()|g' src/MouseGrabber.cpp
# Fix QMouseEvent and QHoverEvent constructors for Qt6 (cast device to QPointingDevice*)
sed -i 's|event->modifiers());|event->modifiers(), static_cast<const QPointingDevice*>(event->device()));|g' src/MouseGrabber.cpp
# Fix Qt6 deprecation warning in qthelper.hpp
sed -i 's|v.type()|v.metaType().id()|g' src/backend_mpv/qthelper.hpp
'';
cmakeFlags = [
"-DQt6_DIR=${pkgs.kdePackages.qtbase}/lib/cmake/Qt6"
"-DUSE_PLASMAPKG=OFF"
"-DQT_MAJOR_VERSION=6"
"-DBUILD_QML=ON"
"-DBUILD_SCENE=OFF"
];
dontWrapQtApps = true;
postInstall = ''
cd $out/share/plasma/wallpapers/com.github.catsout.wallpaperEngineKde
chmod +x ./contents/pyext.py
patchShebangs --build ./contents/pyext.py
cd -
'';
meta = with lib; {
description = "KDE wallpaper plugin integrating Wallpaper Engine";
homepage = "https://github.com/catsout/wallpaper-engine-kde-plugin";
license = licenses.gpl2Plus;
platforms = platforms.linux;
maintainers = [];
};
}