From 246483e3d922e3769b9d28e842e30a84140fcdd1 Mon Sep 17 00:00:00 2001 From: macronova Date: Sun, 15 Sep 2024 18:34:27 -0700 Subject: [PATCH] Reformat --- flake.lock | 49 +++----- flake.nix | 42 +++---- packages/sweet-ambar-blue.nix | 15 ++- packages/wallpaper-engine-plasma5-plugin.nix | 60 ---------- packages/wallpaper-engine-plasma6-plugin.nix | 109 +++++++++++------- .../wallpaper-engine-plasma6-plugin.patch | 52 +++++++++ packages/yorha-grub-theme.nix | 31 ++--- packages/yorha-sound-theme.nix | 7 +- 8 files changed, 187 insertions(+), 178 deletions(-) delete mode 100644 packages/wallpaper-engine-plasma5-plugin.nix create mode 100644 packages/wallpaper-engine-plasma6-plugin.patch diff --git a/flake.lock b/flake.lock index 7b5a2e7..920251c 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "candy-icons": { "flake": false, "locked": { - "lastModified": 1723591882, - "narHash": "sha256-XAB+Ai7r5n/125mmkc/J0J1aPjFgQGeRPT+vc2LP6cE=", + "lastModified": 1724623392, + "narHash": "sha256-0wsSjK8WrwM/yh40a76cYblbv52tdJGTKAdxNU43frc=", "ref": "refs/heads/master", - "rev": "eba39aed603a255ed756ed601e87349561217ef0", - "revCount": 1211, + "rev": "b92b133d0ad7ed5b5e376bd00216a05652277209", + "revCount": 1217, "type": "git", "url": "https://github.com/EliverLara/candy-icons" }, @@ -36,11 +36,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1723362943, - "narHash": "sha256-dFZRVSgmJkyM0bkPpaYRtG/kRMRTorUIDj8BxoOt1T4=", + "lastModified": 1726243404, + "narHash": "sha256-sjiGsMh+1cWXb53Tecsm4skyFNag33GPbVgCdfj3n9I=", "owner": "nixos", "repo": "nixpkgs", - "rev": "a58bc8ad779655e790115244571758e8de055e3d", + "rev": "345c263f2f53a3710abe117f28a5cb86d0ba4059", "type": "github" }, "original": { @@ -59,7 +59,6 @@ "sweet-ambar-blue-dark": "sweet-ambar-blue-dark", "sweet-folders": "sweet-folders", "sweet-kde": "sweet-kde", - "wallpaper-engine-plasma5-plugin": "wallpaper-engine-plasma5-plugin", "wallpaper-engine-plasma6-plugin": "wallpaper-engine-plasma6-plugin", "yorha-grub-theme": "yorha-grub-theme", "yorha-sound-theme": "yorha-sound-theme" @@ -68,11 +67,11 @@ "sweet-ambar-blue": { "flake": false, "locked": { - "lastModified": 1723587745, - "narHash": "sha256-IdOwZM+r9yiWaNnobVGtMjGLGHjQHH0sf/yCFUxIT+0=", + "lastModified": 1725663625, + "narHash": "sha256-H6TEFHxGK/W39eR95v6dwBu7XyzsvajpD/Vn28fc0aI=", "ref": "Ambar-Blue", - "rev": "e133a6b40b0a5d5c8c2163de9b36150b285d15f2", - "revCount": 294, + "rev": "2a5fc9cb672ecfd1f2a6f1f1d289a665891336f0", + "revCount": 297, "type": "git", "url": "https://github.com/EliverLara/Sweet" }, @@ -85,11 +84,11 @@ "sweet-ambar-blue-dark": { "flake": false, "locked": { - "lastModified": 1723587757, - "narHash": "sha256-qrbf1vrFgCxM8p5zAZvYCeoZlG6Mfy9UUbLx9PKUiKM=", + "lastModified": 1725663779, + "narHash": "sha256-ffQGwPhXHOZDhC/F1Enj0zMzbaXRkVbUkok3KfWZycY=", "ref": "Ambar-Blue-Dark", - "rev": "b96bed2f0a22c4431f944489bb37a45bc16e9300", - "revCount": 378, + "rev": "ea071eb2979cd2bc5f9f2a352ab8534279d3c77e", + "revCount": 381, "type": "git", "url": "https://github.com/EliverLara/Sweet" }, @@ -147,24 +146,6 @@ "type": "github" } }, - "wallpaper-engine-plasma5-plugin": { - "flake": false, - "locked": { - "lastModified": 1710844534, - "narHash": "sha256-zVXvyUiigqIOKBKBv82SyjrEnoCNrc+o9Rkc8JXQt98=", - "ref": "refs/heads/main", - "rev": "34f7f01acba3bc8f94d478032cf86aef06b02d26", - "revCount": 572, - "submodules": true, - "type": "git", - "url": "https://github.com/catsout/wallpaper-engine-kde-plugin" - }, - "original": { - "submodules": true, - "type": "git", - "url": "https://github.com/catsout/wallpaper-engine-kde-plugin" - } - }, "wallpaper-engine-plasma6-plugin": { "flake": false, "locked": { diff --git a/flake.nix b/flake.nix index d7e6fd1..f944344 100644 --- a/flake.nix +++ b/flake.nix @@ -24,10 +24,6 @@ flake = false; url = "git+https://github.com/EliverLara/Sweet-kde?ref=plasma6"; }; - wallpaper-engine-plasma5-plugin = { - flake = false; - url = "git+https://github.com/catsout/wallpaper-engine-kde-plugin?submodules=1"; - }; wallpaper-engine-plasma6-plugin = { flake = false; url = "git+https://github.com/catsout/wallpaper-engine-kde-plugin?ref=qt6&submodules=1"; @@ -42,27 +38,33 @@ }; }; - outputs = inputs@{ self, flake-utils, nixpkgs, ... }: - let - pkgDrvDir = ./packages; - pkgDrvs = pkgs: pkgs.lib.attrsets.mapAttrs' - (pkgDrv: _: rec { - name = builtins.substring 0 + outputs = inputs @ { + self, + flake-utils, + nixpkgs, + ... + }: let + pkgDrvDir = ./packages; + pkgDrvs = pkgs: (with pkgs.lib; + builtins.listToAttrs + (builtins.map + (pkgDrv: rec { + name = + builtins.substring 0 ( builtins.sub (builtins.stringLength pkgDrv) 4 ) pkgDrv; - value = import (pkgDrvDir + "/${pkgDrv}") { inherit inputs name pkgs; }; + value = import (pkgDrvDir + "/${pkgDrv}") {inherit inputs name pkgs;}; }) - (builtins.readDir pkgDrvDir); - in + (builtins.filter (pkgDrv: strings.hasSuffix ".nix" pkgDrv) (builtins.attrNames (builtins.readDir pkgDrvDir))))); + in { overlays.default = _: prev: pkgDrvs prev; - } // flake-utils.lib.eachDefaultSystem (system: - let - pkgs = nixpkgs.legacyPackages.${system}; - in - { - packages = pkgDrvs pkgs; - }); + } + // flake-utils.lib.eachDefaultSystem (system: let + pkgs = nixpkgs.legacyPackages.${system}; + in { + packages = pkgDrvs pkgs; + }); } diff --git a/packages/sweet-ambar-blue.nix b/packages/sweet-ambar-blue.nix index 7fbd025..85ae911 100644 --- a/packages/sweet-ambar-blue.nix +++ b/packages/sweet-ambar-blue.nix @@ -1,9 +1,12 @@ -{ inputs, name, pkgs }: - +{ + inputs, + name, + pkgs, +}: pkgs.stdenv.mkDerivation { inherit name; srcs = []; - buildInputs = [ pkgs.jdupes ]; + buildInputs = [pkgs.jdupes]; dontUnpack = true; preInstall = with inputs; '' cp -r ${candy-icons}/ candy-icons/ @@ -30,7 +33,7 @@ pkgs.stdenv.mkDerivation { rm -rf */gtk-3.0/{apps,widgets,*.scss} rm -rf */gtk-4.0/{apps,widgets,*.scss} rm -rf */xfwm4/{assets,render_assets.fish} - + # Install icons mkdir -p $out/share/icons/ mv candy-icons/ $out/share/icons/candy-icons/ @@ -60,7 +63,7 @@ pkgs.stdenv.mkDerivation { # Replace duplicate files with symbolic links to the first file in each set of duplicates jdupes --quiet --link-soft --recurse $out/share/ - + runHook postInstall - ''; + ''; } diff --git a/packages/wallpaper-engine-plasma5-plugin.nix b/packages/wallpaper-engine-plasma5-plugin.nix deleted file mode 100644 index 5b03d86..0000000 --- a/packages/wallpaper-engine-plasma5-plugin.nix +++ /dev/null @@ -1,60 +0,0 @@ -{ inputs, name, pkgs }: - -pkgs.plasma5Packages.callPackage - ( - { mkDerivation - , cmake - , extra-cmake-modules - , gst-libav - , lz4 - , mpv - , pkg-config - , python-ws - , plasma-framework - , qtdeclarative - , qtwebsockets - , qtwebchannel - , qtx11extras - , vulkan-headers - , vulkan-loader - , vulkan-tools - , websockets - }: - - mkDerivation { - inherit name; - cmakeFlags = [ "-DUSE_PLASMAPKG=ON" ]; - nativeBuildInputs = [ cmake extra-cmake-modules pkg-config ]; - buildInputs = [ - lz4 - mpv - plasma-framework - python-ws - qtdeclarative - qtwebchannel - qtwebsockets - qtx11extras - vulkan-headers - vulkan-tools - vulkan-loader - websockets - ]; - postInstall = '' - chmod +x ../plugin/contents/pyext.py - PATH=${python-ws}/bin:$PATH patchShebangs --build ../plugin/contents/pyext.py - sed -i "18i \\ \"[ -f \\\\\"${placeholder "out"}/share/\$EXT\\\\\" ] && WKD=\\\\\"${placeholder "out"}/share/\$EXT\\\\\"\"," ../plugin/contents/ui/Pyext.qml - sed -i "s/exec python3 //g" ../plugin/contents/ui/Pyext.qml - mkdir -p $out/share/plasma/wallpapers/com.github.casout.wallpaperEngineKde/ - cp -r ../plugin/* $out/share/plasma/wallpapers/com.github.casout.wallpaperEngineKde/ - ''; - src = inputs.${name}; - } - ) - (with pkgs; { - inherit (gst_all_1) gst-libav; - inherit (python3Packages) websockets; - python-ws = python3.withPackages (ps: with ps; [ - websockets - ]); - }) - diff --git a/packages/wallpaper-engine-plasma6-plugin.nix b/packages/wallpaper-engine-plasma6-plugin.nix index a1afa1a..a054475 100644 --- a/packages/wallpaper-engine-plasma6-plugin.nix +++ b/packages/wallpaper-engine-plasma6-plugin.nix @@ -1,48 +1,73 @@ -{ inputs, name, pkgs }: - -pkgs.kdePackages.callPackage - ( - { extra-cmake-modules - , full - , kpackage - , libplasma - , lib - , lz4 - , mkKdeDerivation - , mpv - , pkg-config - , python-ws - }: - +{ + inputs, + name, + pkgs, +}: +pkgs.kdePackages.callPackage ( + { + extra-cmake-modules, + fetchFromGitHub, + kpackage, + libplasma, + lib, + lz4, + mkKdeDerivation, + mpv, + pkg-config, + python3, + qtbase, + qtmultimedia, + qtwebchannel, + qtwebengine, + qtwebsockets, + }: mkKdeDerivation { - extraBuildInputs = [ - extra-cmake-modules - full - libplasma - lz4 - mpv - ]; - extraCmakeFlags = [ "-DUSE_PLASMAPKG=ON" ]; + pname = name; + version = "latest"; + + src = inputs.${name}; + + patches = [./${name}.patch]; + extraNativeBuildInputs = [ kpackage pkg-config ]; - meta.license = with lib.licenses; [ gpl2 ]; - pname = name; - postInstall = '' - chmod +x ../plugin/contents/pyext.py - PATH=${python-ws}/bin:$PATH patchShebangs --build ../plugin/contents/pyext.py - sed -i "18i \\ \"[ -f \\\\\"${placeholder "out"}/share/\$EXT\\\\\" ] && WKD=\\\\\"${placeholder "out"}/share/\$EXT\\\\\"\"," ../plugin/contents/ui/Pyext.qml - sed -i "s/exec python3 //g" ../plugin/contents/ui/Pyext.qml - kpackagetool6 -i ../plugin/ -p $out/share/plasma/wallpapers/ - ''; - src = inputs.${name}; - version = "latest"; - } - ) -{ - python-ws = pkgs.python3.withPackages (ps: with ps; [ - websockets - ]); -} + extraBuildInputs = [ + extra-cmake-modules + libplasma + lz4 + mpv + ]; + + extraCmakeFlags = [ + "-DQML2_CMAKE_PATH=${ + lib.makeSearchPath "lib/qt-6/qml" [ + qtmultimedia + qtwebchannel + qtwebengine + qtwebsockets + ] + }" + "-DQt6_DIR=${qtbase}/lib/cmake/Qt6" + "-DUSE_PLASMAPKG=ON" + ]; + + postInstall = let + py3-ws = python3.withPackages (ps: with ps; [websockets]); + in '' + cd ../plugin + PATH=${py3-ws}/bin:$PATH patchShebangs --build ./contents/pyext.py + substituteInPlace ./contents/ui/Pyext.qml --replace-fail NIX_STORE_PACKAGE_PATH ${placeholder "out"} + kpackagetool6 -i ./ -p $out/share/plasma/wallpapers/ + ''; + + meta = with lib; { + description = "KDE wallpaper plugin integrating Wallpaper Engine"; + homepage = "https://github.com/catsout/wallpaper-engine-kde-plugin"; + license = licenses.gpl2Only; + }; + } +) +{} diff --git a/packages/wallpaper-engine-plasma6-plugin.patch b/packages/wallpaper-engine-plasma6-plugin.patch new file mode 100644 index 0000000..951250a --- /dev/null +++ b/packages/wallpaper-engine-plasma6-plugin.patch @@ -0,0 +1,52 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e1298ba..1c9ddec 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -9,6 +9,7 @@ set(KF_MIN_VERSION "5.68.0") + project("WallpaperEngineKde") + + ++add_definitions(-DQML2_CMAKE_PATH="${QML2_CMAKE_PATH}") + 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..8a9c9c9 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 5e8a7e2..1709a27 100644 +--- a/src/plugin.cpp ++++ b/src/plugin.cpp +@@ -13,6 +13,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 = QML2_CMAKE_PATH; ++ 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"); diff --git a/packages/yorha-grub-theme.nix b/packages/yorha-grub-theme.nix index 0eb471d..09ef869 100644 --- a/packages/yorha-grub-theme.nix +++ b/packages/yorha-grub-theme.nix @@ -1,14 +1,17 @@ -{ inputs, name, pkgs, resolution ? "2560x1440" }: - -assert builtins.any (s: resolution == s) [ "1920x1080" "2256x1504" "2560x1440" "3840x2160" ]; - -pkgs.stdenv.mkDerivation { - inherit name; - src = inputs.${name}; - installPhase = '' - runHook preInstall - mkdir -p $out/ - cp -r yorha-${resolution}/* $out/ - runHook postInstall - ''; -} +{ + inputs, + name, + pkgs, + resolution ? "2560x1440", +}: +assert builtins.any (s: resolution == s) ["1920x1080" "2256x1504" "2560x1440" "3840x2160"]; + pkgs.stdenv.mkDerivation { + inherit name; + src = inputs.${name}; + installPhase = '' + runHook preInstall + mkdir -p $out/ + cp -r yorha-${resolution}/* $out/ + runHook postInstall + ''; + } diff --git a/packages/yorha-sound-theme.nix b/packages/yorha-sound-theme.nix index 692781f..d931c03 100644 --- a/packages/yorha-sound-theme.nix +++ b/packages/yorha-sound-theme.nix @@ -1,5 +1,8 @@ -{ inputs, name, pkgs }: - +{ + inputs, + name, + pkgs, +}: pkgs.stdenv.mkDerivation { inherit name; src = inputs.${name};