Skip to content

Instantly share code, notes, and snippets.

@BBArikL
Last active April 11, 2025 01:15
Show Gist options
  • Save BBArikL/b389c4592d636380523e03ac423b77b3 to your computer and use it in GitHub Desktop.
Save BBArikL/b389c4592d636380523e03ac423b77b3 to your computer and use it in GitHub Desktop.
wallpaper-engine-kde-plugin on NixOS
{ config, lib, pkgs, ...}:
let
# References: https://github.com/xerhaxs/nixos/blob/main/nixosModules/pkgs/wallpaper-engine-kde-plugin.nix and https://discourse.nixos.org/t/wallpaper-engine-on-nixos-wallpaper-engine-kde-plugin/19744/25
glslang-submodule = with pkgs; stdenv.mkDerivation {
name = "glslang";
installPhase = ''
mkdir -p $out
'';
src = fetchFromGitHub {
owner = "KhronosGroup";
repo = "glslang";
rev = "c34bb3b6c55f6ab084124ad964be95a699700d34";
sha256 = "IMROcny+b5CpmzEfvKBYDB0QYYvqC5bq3n1S4EQ6sXc=";
};
};
wallpaper-engine-kde-plugin = with pkgs; stdenv.mkDerivation rec {
pname = "wallpaperEngineKde";
version = "96230de92f1715d3ccc5b9d50906e6a73812a00a";
src = fetchFromGitHub {
owner = "Jelgnum";
repo = "wallpaper-engine-kde-plugin";
rev = version;
hash = "sha256-vkWEGlDQpfJ3fAimJHZs+aX6dh/fLHSRy2tLEsgu/JU=";
fetchSubmodules = true;
};
nativeBuildInputs = [
cmake
kdePackages.extra-cmake-modules
glslang-submodule
pkg-config
gst_all_1.gst-libav
shaderc
ninja
];
buildInputs = [
mpv
lz4
vulkan-headers
vulkan-tools
vulkan-loader
]
++ (with kdePackages; with qt6Packages; [
qtbase
qt6.full
kpackage
kdeclarative
libplasma
qtwebsockets
qtwebengine
qtwebchannel
qtmultimedia
qtdeclarative
])
++ [(python3.withPackages (python-pkgs: [ python-pkgs.websockets ]))];
cmakeFlags = [ "-DUSE_PLASMAPKG=OFF" ];
dontWrapQtApps = true;
postPatch = ''
rm -rf src/backend_scene/third_party/glslang
ln -s ${glslang-submodule.src} src/backend_scene/third_party/glslang
'';
#Optional informations
meta = with lib; {
description = "Wallpaper Engine KDE plasma plugin";
homepage = "https://github.com/Jelgnum/wallpaper-engine-kde-plugin";
license = licenses.gpl2Plus;
platforms = platforms.linux;
};
};
in
{
options.nixos = {
pkgs.wallpaper-engine-kde-plugin = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Enable wallpaper-engine-kde-plugin.";
};
};
};
config = lib.mkIf (config.nixos.pkgs.wallpaper-engine-kde-plugin.enable) {
environment.systemPackages = with pkgs; [
wallpaper-engine-kde-plugin
kdePackages.qtwebsockets
kdePackages.qtwebchannel
(python3.withPackages (python-pkgs: [ python-pkgs.websockets ]))
];
system.activationScripts = {
wallpaper-engine-kde-plugin.text = ''
wallpaperenginetarget=/share/plasma/wallpapers/com.github.catsout.wallpaperEngineKde
mkdir -p /home/${builtins.head (builtins.attrNames config.users.users)}/.local/share/plasma/wallpapers
chown -R ${builtins.head (builtins.attrNames config.users.users)}:users /home/${builtins.head (builtins.attrNames config.users.users)}/.local/share/plasma
if [ ! -e /home/${builtins.head (builtins.attrNames config.users.users)}/.local$wallpaperenginetarget ]; then
ln -sf ${wallpaper-engine-kde-plugin}$wallpaperenginetarget /home/${builtins.head (builtins.attrNames config.users.users)}/.local$wallpaperenginetarget
fi;
'';
};
};
}
@BBArikL
Copy link
Author

BBArikL commented Apr 5, 2025

Hey! Yes the store path is different between each system and each nix generation (its basically a hash that is derived from your system configuration). Before, I was not using a leading / for the wallpaper engine target, but I was corrected by people in that discourse thread to add that leading forward slash. I think I have an inconsistent usage of the $wallpaperenginetarget. I'll make a new revision but I cannot test it right now. For people on nixos unstable, I'd recommend to go for the one in the official (nix) repo. If it ever comes on nixos stable, I will stop maintaining this gist and use the one which is in the nix repo.

@qwbarch
Copy link

qwbarch commented Apr 11, 2025

Thanks for making this package!

OK, this error disappeared after use this config: https://github.com/xerhaxs/nixos/blob/main/nixosModules/pkgs/wallpaper-engine-kde-plugin.nix

I indeed needed this as well to make python run properly. Seems like video wallpapers run (after installing qtmultimediate) while all scene wallpapers have a black screen. Is that an issue with the packaging or the plugin itself? wallpaper-engine-kde-plugin seems to support scene wallpapers so I'm not sure if I'm just doing something wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment