Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mnemosyne: Fix Qt related segfault and OpenGL warning #84954

Merged
merged 4 commits into from Apr 13, 2020

Conversation

unode
Copy link
Member

@unode unode commented Apr 10, 2020

Motivation for this change

Mnemosyne fails to launch with:

Warning: Could not import OpenGL. Might cause a black screen on some Linux distributions. Try installing python3-opengl in that case.
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.

abort (core dumped)
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

cc #65399

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Apr 11, 2020

I can't build the package because cherrypy tests are failing. Can you look into it?

@unode
Copy link
Member Author

unode commented Apr 11, 2020

I worked around cherrypy failures by skipping tests there. It didn't affect mnemosyne.

There's also #84897

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Apr 13, 2020

The way you're doing it is ok but it results in a double wrapped executable.
It's not your fault, the whole wrapping situation is a mess. Since you are manually pulling in wrapQtAppsHook you don't have to use mkDerivationWith and to avoid the double wrapper you can use makeWrapperArgs to pass the Qt arguments to buildPythonApplication which is already making a wrapper.

I don't want to directly mess with your PR so here's a git request-pull

The following changes since commit 7f2f02b45195aba85c67f6db05928e67345b2a7d:

  mnemosyne: Install mnemosyne.desktop (2020-04-11 02:16:16 +0200)

are available in the Git repository at:

  git@github.com:rnhmjoj/nixpkgs.git mnemosyne

for you to fetch changes up to 385baa0223f819f50bfba203795877ba44a188bc:

  mnemosyne: avoid double wrapping (2020-04-13 12:05:18 +0200)

----------------------------------------------------------------
rnhmjoj (2):
      pythonPackages.cherrypy: disable failing test
      mnemosyne: avoid double wrapping

 pkgs/development/python-modules/cherrypy/default.nix |  6 +++++-
 pkgs/games/mnemosyne/default.nix                     | 10 ++++------
 pkgs/top-level/all-packages.nix                      |  2 +-
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/pkgs/development/python-modules/cherrypy/default.nix b/pkgs/development/python-modules/cherrypy/default.nix
index e37f2cb470e..09f6c65bf08 100644
--- a/pkgs/development/python-modules/cherrypy/default.nix
+++ b/pkgs/development/python-modules/cherrypy/default.nix
@@ -44,7 +44,11 @@ buildPythonPackage rec {
   # Disable doctest plugin because times out
   checkPhase = ''
     substituteInPlace pytest.ini --replace "--doctest-modules" ""
-    pytest --deselect=cherrypy/test/test_static.py::StaticTest::test_null_bytes ${stdenv.lib.optionalString stdenv.isDarwin "--deselect=cherrypy/test/test_bus.py::BusMethodTests::test_block"}
+    pytest \
+      --deselect=cherrypy/test/test_static.py::StaticTest::test_null_bytes \
+      --deselect=cherrypy/test/test_tools.py::ToolTests::testCombinedTools \
+      ${stdenv.lib.optionalString stdenv.isDarwin
+      "--deselect=cherrypy/test/test_bus.py::BusMethodTests::test_block"}
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/games/mnemosyne/default.nix b/pkgs/games/mnemosyne/default.nix
index 0038c353d58..44bd396e9fa 100644
--- a/pkgs/games/mnemosyne/default.nix
+++ b/pkgs/games/mnemosyne/default.nix
@@ -1,10 +1,9 @@
 { fetchurl
-, mkDerivationWith
 , python
 , anki
 }:
 
-mkDerivationWith python.pkgs.buildPythonApplication rec {
+python.pkgs.buildPythonApplication rec {
   pname = "mnemosyne";
   version = "2.7.1";
 
@@ -46,10 +45,9 @@ mkDerivationWith python.pkgs.buildPythonApplication rec {
 
   dontWrapQtApps = true;
 
-  postFixup = ''
-    wrapProgram $out/bin/mnemosyne \
-      "''${qtWrapperArgs[@]}"
-  '';
+  makeWrapperArgs = [
+    "\${qtWrapperArgs[@]}"
+  ];
 
   meta = {
     homepage = "https://mnemosyne-proj.org/";
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index f1d11055d7f..7aeaad31280 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -23544,7 +23544,7 @@ in
 
   minetest = minetestclient_5;
 
-  mnemosyne = libsForQt5.callPackage ../games/mnemosyne {
+  mnemosyne = callPackage ../games/mnemosyne {
     python = python3;
   };
 

@unode
Copy link
Member Author

unode commented Apr 13, 2020

Updated the PR accordingly. Kinda confusing cause the makeWrapperArgs was already there through preFixup already.

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Apr 13, 2020

Yes, it is confusing: hopefully by the next release we'll have declarative wrappers to ease the situation. Thank you.

@rnhmjoj rnhmjoj merged commit 64e9b70 into NixOS:master Apr 13, 2020
@rnhmjoj
Copy link
Contributor

rnhmjoj commented Apr 13, 2020

I backported the relevant changes to 20.03.

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

Successfully merging this pull request may close these issues.

None yet

2 participants