Wallpaper Engine on NixOS (wallpaper-engine-kde-plugin)

Hi, I recently installed NixOS and I’ve been trying to get to install the Wallpaper Engine KDE Plugin, but I’m stuck.

The plugin repository is here: https://github.com/catsout/wallpaper-engine-kde-plugin

I’ve created a nix-shell using the following command:

nix-shell -p git cmake extra-cmake-modules libsForQt5.plasma-framework gst_all_1.gst-libav mpv python39Packages.websockets libsForQt5.qtwebsockets libsForQt5.qtwebchannel libsForQt5.qt5.qtdeclarative libsForQt5.qt5.qtx11extras vulkan-headers vulkan-tools vulkan-loader lz4

I can compile it without issue, and I can even use “make install_pkg” to install the plugin into KDE plasma successfully (I’m missing some runtime dependencies for the plugin still, but otherwise installs fine).

But I’m not able to install the “lib” using “sudo make install”.
This “lib” provides the actual video back-end for the wallpapers.
It’s probably trying to install to a path which is not correct.
The output is the following:

Install the project...
-- Install configuration: "Release"
CMake Error at src/cmake_install.cmake:62 (file):
  file cannot create directory:
  /nix/store/0vkrjmwb1rrivl2zg6lcjggsii0ahr5d-extra-cmake-modules-5.93.0/lib/qml/com/github/catsout/wallpaperEngineKde.
  Maybe need administrative privileges.
Call Stack (most recent call first):
  cmake_install.cmake:47 (include)


make: *** [Makefile:100: install] Error 1

If I can get it to work I will try to package it.

I don’t really know how to fix this issue as I’m not quite familiar with how Nix works.

Any help is appreciated!

1 Like

Hi,

You cannot run the make install_pkg manually (the nix store is readonly).

Therefore you should package the plugin and include it in your home-manager or Nixos configuration, depending how you are deploying your Kde configuration.

Do you know how to make such a package ?

Hi! So the hint is this:

file cannot create directory:
  /nix/store/0vkrjmwb1rrivl2zg6lcjggsii0ahr5d-extra-cmake-modules-5.93.0/lib/qml/com/github/catsout/wallpaperEngineKde.

Cmake isn’t very explicit about this, but that’s because /nix/store is read-only. I’m not sure why it’s trying to write to that path of all places, but there’s probably some prefix auto detection going on that makes it decide that path is the correct place to write files to.

Unfortunately for you, it isn’t.

I don’t know enough about cmake on nixos to tell you how to hack around this limitation, but the correct way of building all of this in nixos would be to package it. Nixpkgs’ stdenv.mkDerivation has built-in support for cmake, so maybe it isn’t all that hard: Nixpkgs 23.11 manual | Nix & NixOS

The stdenv docs go over building custom packages in all kinds of detail: Nixpkgs 23.11 manual | Nix & NixOS. One day I’ll write some articles on this kind of stuff I can just link to, but I’m sure there are other posts you can find…

I’m not very experienced with KDE or KDE plugin dev, so can’t help much with packaging that part, but if you struggle getting a package for the cmake bits (or even just getting started) I can try to help :slight_smile:

Note this is all very easy to do downstream, so you don’t need to package and share your package, unlike with other distros.

In case you need help to create a package:

wallpaper-engine-plasma-plugin.nix:

{ mkDerivation
, fetchFromGitHub
, cmake
, extra-cmake-modules
, plasma-framework
, gst-libav
, mpv
, websockets
, qtwebsockets
, qtwebchannel
, qtdeclarative
, qtx11extras
, vulkan-headers
, vulkan-loader
, vulkan-tools
, pkg-config
, lz4
, glslang
}:

mkDerivation rec {
  pname = "wallpaper-engine-kde-plugin";
  version = "0.5.3";

  cmakeFlags = [ "-DUSE_PLASMAPKG=ON" ];
  nativeBuildInputs = [ cmake extra-cmake-modules pkg-config ];
  buildInputs = [ 
    plasma-framework mpv qtwebsockets websockets qtwebchannel
    qtdeclarative qtx11extras lz4
    vulkan-headers vulkan-tools vulkan-loader
  ];

  postPatch = ''
    rmdir src/backend_scene/third_party/glslang
    ln -s ${glslang.src} src/backend_scene/third_party/glslang
  '';

  src = fetchFromGitHub {
    owner = "catsout";
    repo = pname;
    rev = "v${version}";
    sha256 = "qmg+g1you3rm1EAfZWRUBBkEQm1QQ0V9/mIn8bBgbu4=";
  };
}

and in your configuration file:

let
  engine = pkgs.plasma5Packages.callPackage ./wallpaper-engine-plasma-plugin.nix {
    inherit (pkgs.gst_all_1) gst-libav;
    inherit (pkgs.python3Packages) websockets;
  };
in
...

disclaimer: I built it but I don’t have KDE on this machine

1 Like

This looks great!
Just one question where should I put the wallpaper-engine-plasma-plugin.nix file?

I have cloned nixpkgs but I’m guessing I don’t really need it!

Thanks!

Well you can put it in the same directory as configuration.nix (by the way I had to edit my callPackage call

It compiles correctly, but if DUSE_PLASMAPKG is ON it doesn’t install the plasma plugin, just the lib.
And changing it to OFF does install the plasma plugin correctly but shows the following message

Python helper run failed:
python3: can’t open file ‘/home/spp/no_pyext_file_found’: [Errno 2] No such file or directory

hum weird.

Ok plasmapkg is trying to install to your home … so ok it should be off.
No idea where the pyext error come from, sorry

I’ll try to figure out what is causing the issue.

Thanks for helping with the package!

Necrobumping to ask if you got it to work. I’ve also been trying to write a derivation for this plugin, but with no success.

No, I wasn’t able to get it working.
I haven’t tried newer versions as I moved distro…

how is it different from linux-wallpaperengine: init at 2022-08-22 by rapenne-s · Pull Request #188136 · NixOS/nixpkgs · GitHub ?

linux-wallpaperengine doesn’t work on Plasma, GNOME and other DEs.
wallpaper-engine-kde-plugin is integrated and made to work for KDE Plasma

1 Like

What is your current state? Is it working?

No, sorry. I switched distributions

That’s sad. Than I will try it on my own.

So I try to get it running, but I always get following error and don’t know how to fix it:

CMake Error at src/backend_scene/third_party/glslang/CMakeLists.txt:281 (message):
  ENABLE_OPT set but SPIR-V tools not found.  Please run
  update_glslang_sources.py, set the ALLOW_EXTERNAL_SPIRV_TOOLS option to use
  a local install of SPIRV-Tools, or set ENABLE_OPT=0.

Any ideas how to fix that?

Hi. I was recently looking for ways to make this plugin work.
There seem to be a a few pioneers running this plugin on Nix.
https://github.com/search?q=language%3ANix+wallpaper-engine-kde-plugin&type=code

This is my nix file and plugin works fine.

Thank you so much! I was already despairing. It’s working now.

I have to correct myself. I was a bit hasty. It compiles, but when I want to select Engigne as desktop background wallpaper, there is no such option. What else did you do differently?