Help fixing raysession package

Currently, the package in nixpkgs for RaySession installs just fine but the program it produces can’t be run due to a missing library. I made an issue for this and I’ve tried fixing the issue by editing the package, but nothing seems to work. Does anyone have an idea of how I can make this package work? I need it for a project I’m working on, so I’d like to fix it soon.

Here is the error that gets thrown when running raysession after install.

qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

zsh: abort (core dumped)  raysession

Also, PS - the package for patchance was created at the same time by the same author (in #224153) and it gives the same error when run.

@tobiasBora do you have any ideas here? I remember you made a package for raysession in another post. I tried out the package you made but it didn’t work even after calling the package with all the arguments it requests (as follows).

  raysession = callPackage ../applications/audio/raysession {
    inherit (python3Packages) buildPythonApplication pydbus pyliblo pyqt5;
    inherit (qt5) qttools;
  };

If anyone wants to test this on their machine, all you need to run is

nix-shell -p raysession --command raysession

(This should fail and print the errors described above.)

The program is missing a wrapper. Try this, it worked for me (I basically just added qt5.wrapQtAppsHook in the list of dependencies and used wrapQtApp on all files in $out/bin… but this certainly require some more testing):

{ lib, fetchurl, buildPythonApplication, libjack2, pydbus, pyliblo, pyqt5, which, bash, qt5 }:

buildPythonApplication rec {
  pname = "raysession";
  version = "0.13.1";

  src = fetchurl {
    url = "https://github.com/Houston4444/RaySession/releases/download/v${version}/RaySession-${version}-source.tar.gz";
    sha256 = "sha256-iiFRtX43u9BHe7a4ojza7kav+dMW9e05dPi7Gf9d1GM=";
  };

  postPatch = ''
    # Fix installation path of xdg schemas.
    substituteInPlace Makefile --replace '$(DESTDIR)/' '$(DESTDIR)$(PREFIX)/'
    # Do not wrap an importable module with a shell script.
    chmod -x src/daemon/desktops_memory.py
  '';

  format = "other";

  nativeBuildInputs = [
    pyqt5   # pyuic5 and pyrcc5 to build resources.
    qt5.qttools # lrelease to build translations.
    which   # which to find lrelease.
    qt5.wrapQtAppsHook
  ];
  buildInputs = [ libjack2 bash ];
  propagatedBuildInputs = [ pydbus pyliblo pyqt5 ];

  dontWrapQtApps = true; # The program is a python script.

  installFlags = [ "PREFIX=$(out)" ];

  makeWrapperArgs = [
    "--prefix" "LD_LIBRARY_PATH" ":" (lib.makeLibraryPath [ libjack2 ])
  ];

  postFixup = ''
    wrapPythonProgramsIn "$out/share/raysession/src" "$out $pythonPath" "$out/bin"
    for file in $out/bin/*; do
      wrapQtApp "$file"
    done
  '';

  meta = with lib; {
    homepage = "https://github.com/Houston4444/RaySession";
    description = "Session manager for Linux musical programs";
    license = licenses.gpl2;
    maintainers = with maintainers; [ orivej ];
    platforms = platforms.linux;
  };
}
1 Like

Yay! Thank you so much @tobiasBora! I’ll submit these changes to nixpkgs!

Np! Oh, I just submitted a PR here, raysession: Fix issues with qt not being patched (can’t find platform, qt version mismatch error etc) by tobiasBora · Pull Request #236762 · NixOS/nixpkgs · GitHub but you might want to fix the second program you mention as well.

Ah yes! I’ll see if the same changes can apply to it as well!

I actually have my own package for patchance that is written differently and somehow doesn’t suffer from this issue. I think it might have to do with the fact that I’m using stdenv.mkDerivation rather than buildPythonApplication. Do you know what’s going on here?

Made a PR to fix patchance
https://github.com/NixOS/nixpkgs/pull/236767

1 Like