{ lib, pkgs, inputs, config, namespace, ... }: let # Import the plugin as a package derivation from your local repo # Pass the 'inputs' parameter explicitly to make wallpaper-engine-plugin-src available wallpaperEnginePkg = pkgs.callPackage ../../../packages/wallpaper-engine-kde-plugin/default.nix { inherit inputs; }; in { options.${namespace}.wallpaper-engine-kde-plugin.enable = lib.mkEnableOption "Enable Wallpaper Engine KDE plugin"; config = lib.mkIf config.${namespace}.wallpaper-engine-kde-plugin.enable { # Add the imported package and helper script to systemPackages environment.systemPackages = [ wallpaperEnginePkg (pkgs.writeShellScriptBin "wallpaper-engine-kde-setup" '' #!/usr/bin/env bash set -e STEAM_DIR="$HOME/.local/share/Steam" WORKSHOP_PATH="$STEAM_DIR/steamapps/workshop/content/431960" echo "Wallpaper Engine KDE Plugin Setup Helper" echo "========================================" # Check if Steam directory exists if [ -d "$STEAM_DIR" ]; then echo "✅ Steam directory found at: $STEAM_DIR" if [ -d "$WORKSHOP_PATH" ]; then echo "✅ Workshop content directory found at: $WORKSHOP_PATH" echo " You can use this path in the wallpaper settings." else echo "⚠️ Workshop content directory not found at the expected location." echo " Please locate your Steam workshop content for Wallpaper Engine (app ID 431960)" fi else echo "⚠️ Steam directory not found at: $STEAM_DIR" echo " Please install Steam and Wallpaper Engine first." fi # Check symlinks if [ -L "$HOME/.local/share/plasma/wallpapers/com.github.catsout.wallpaperEngineKde" ]; then echo "✅ Plugin symlink is correctly set up" else echo "⚠️ Plugin symlink not found, attempting to create it..." mkdir -p "$HOME/.local/share/plasma/wallpapers" ln -sf /run/current-system/sw/share/plasma/wallpapers/com.github.catsout.wallpaperEngineKde \ "$HOME/.local/share/plasma/wallpapers/com.github.catsout.wallpaperEngineKde" echo " Done! Symlink created." fi echo "" echo "To use Wallpaper Engine wallpapers in KDE:" echo "1. Right-click on desktop → Configure Desktop and Wallpaper" echo "2. Select 'Wallpaper Engine' from the wallpaper type list" echo "3. Set the path to your workshop content directory" '') ]; systemd.user.services.wallpaperEngineSymlink = { description = "Symlink Wallpaper Engine plugin for Plasma"; wantedBy = [ "graphical-session.target" ]; serviceConfig = { Type = "oneshot"; ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p %h/.local/share/plasma/wallpapers"; ExecStart = "${pkgs.coreutils}/bin/ln -sfn /run/current-system/sw/share/plasma/wallpapers/com.github.catsout.wallpaperEngineKde %h/.local/share/plasma/wallpapers/com.github.catsout.wallpaperEngineKde"; RemainAfterExit = true; }; }; }; }