diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 52cf46a7bab5..2405a8419e65 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -14009,6 +14009,14 @@ github = "mac-chaffee"; githubId = 7581860; }; + macronova = { + name = "Sicheng Pan"; + email = "trivial@invariantspace.com"; + matrix = "@macronova:invariantspace.com"; + github = "Sicheng-Pan"; + githubId = 60079945; + keys = [ { fingerprint = "7590 C9DD E19D 4497 9EE9 0B14 CE96 9670 FB4B 4A56"; } ]; + }; madjar = { email = "georges.dubus@compiletoi.net"; github = "madjar"; diff --git a/pkgs/kde/default.nix b/pkgs/kde/default.nix index b41499b042ee..76a9d19e28aa 100644 --- a/pkgs/kde/default.nix +++ b/pkgs/kde/default.nix @@ -93,6 +93,7 @@ let koi = self.callPackage ./third-party/koi { }; krohnkite = self.callPackage ./third-party/krohnkite { }; kzones = self.callPackage ./third-party/kzones { }; + wallpaper-engine-plugin = self.callPackage ./third-party/wallpaper-engine-plugin { }; } ); in diff --git a/pkgs/kde/third-party/wallpaper-engine-plugin/default.nix b/pkgs/kde/third-party/wallpaper-engine-plugin/default.nix new file mode 100644 index 000000000000..4ea13d340dbf --- /dev/null +++ b/pkgs/kde/third-party/wallpaper-engine-plugin/default.nix @@ -0,0 +1,72 @@ +{ + extra-cmake-modules, + fetchFromGitHub, + kpackage, + libplasma, + lib, + lz4, + mkKdeDerivation, + mpv-unwrapped, + pkg-config, + python3, + qtbase, + qtmultimedia, + qtwebchannel, + qtwebengine, + qtwebsockets, +}: +mkKdeDerivation { + pname = "wallpaper-engine-kde-plugin"; + version = "0.5.5-unstable-2024-11-03"; + + src = fetchFromGitHub { + owner = "catsout"; + repo = "wallpaper-engine-kde-plugin"; + rev = "ed58dd8b920dbb2bf0859ab64e0b5939b8a32a0e"; + hash = "sha256-ICQLtw+qaOMf0lkqKegp+Dkl7eUgPqKDn8Fj5Osb7eA="; + fetchSubmodules = true; + }; + + patches = [ ./nix-plugin.patch ]; + + extraNativeBuildInputs = [ + kpackage + pkg-config + (python3.withPackages (ps: with ps; [ websockets ])) + ]; + + extraBuildInputs = [ + extra-cmake-modules + libplasma + lz4 + mpv-unwrapped + ]; + + extraCmakeFlags = [ + (lib.cmakeFeature "QML_LIB" ( + lib.makeSearchPathOutput "out" "lib/qt-6/qml" [ + qtmultimedia + qtwebchannel + qtwebengine + qtwebsockets + ] + )) + (lib.cmakeFeature "Qt6_DIR" "${qtbase}/lib/cmake/Qt6") + ]; + + postInstall = '' + cd $out/share/plasma/wallpapers/com.github.catsout.wallpaperEngineKde + chmod +x ./contents/pyext.py + patchShebangs --build ./contents/pyext.py + substituteInPlace ./contents/ui/Pyext.qml \ + --replace-fail NIX_STORE_PACKAGE_PATH ${placeholder "out"} + cd - + ''; + + meta = with lib; { + description = "KDE wallpaper plugin integrating Wallpaper Engine"; + homepage = "https://github.com/catsout/wallpaper-engine-kde-plugin"; + license = licenses.gpl2Only; + maintainers = with maintainers; [ macronova ]; + }; +} diff --git a/pkgs/kde/third-party/wallpaper-engine-plugin/nix-plugin.patch b/pkgs/kde/third-party/wallpaper-engine-plugin/nix-plugin.patch new file mode 100644 index 000000000000..b689f4937946 --- /dev/null +++ b/pkgs/kde/third-party/wallpaper-engine-plugin/nix-plugin.patch @@ -0,0 +1,52 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e1298ba..1af7d0a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -9,6 +9,7 @@ set(KF_MIN_VERSION "5.68.0") + project("WallpaperEngineKde") + + ++add_definitions(-DQML_LIB="${QML_LIB}") + set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY true) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + if(NOT OpenGL_GL_PREFERENCE) +diff --git a/plugin/contents/pyext.py b/plugin/contents/pyext.py +old mode 100644 +new mode 100755 +diff --git a/plugin/contents/ui/Pyext.qml b/plugin/contents/ui/Pyext.qml +index 1a48f5e..7db2480 100644 +--- a/plugin/contents/ui/Pyext.qml ++++ b/plugin/contents/ui/Pyext.qml +@@ -15,7 +15,8 @@ Item { + "[ -f /usr/share/$EXT ] && WKD=/usr/share/$EXT", + "[ -f \"$HOME/.local/share/$EXT\" ] && WKD=\"$HOME/.local/share/$EXT\"", + "[ -f \"$XDG_DATA_HOME/$EXT\" ] && WKD=\"$XDG_DATA_HOME/$EXT\"", +- `exec python3 "$WKD" "${ws_server.url}"` ++ "[ -f \"NIX_STORE_PACKAGE_PATH/share/$EXT\" ] && WKD=\"NIX_STORE_PACKAGE_PATH/share/$EXT\"", ++ `"$WKD" "${ws_server.url}"` + ].join("\n"); + return sh; + } +diff --git a/src/plugin.cpp b/src/plugin.cpp +index 4bc817e..a98cb4a 100644 +--- a/src/plugin.cpp ++++ b/src/plugin.cpp +@@ -14,6 +14,18 @@ class Port : public QQmlExtensionPlugin { + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) + + public: ++ void initializeEngine(QQmlEngine *engine, const char *uri) override { ++ if (strcmp(uri, "com.github.catsout.wallpaperEngineKde") != 0) return; ++ if (!engine) return; ++ ++ QString pathList = QML_LIB; ++ QStringList paths = pathList.split(':', Qt::SkipEmptyParts); ++ for (const QString &path : paths) { ++ engine->addImportPath(path); ++ } ++ ++ QQmlExtensionPlugin::initializeEngine(engine, uri); ++ } + void registerTypes(const char* uri) override { + if (strcmp(uri, "com.github.catsout.wallpaperEngineKde") != 0) return; + qmlRegisterType(uri, WPVer[0], WPVer[1], "PluginInfo");