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

octave: use qt-5 mkDerivation for wrapQtAppsHook #96985

Merged

Conversation

graham33
Copy link
Contributor

@graham33 graham33 commented Sep 2, 2020

Motivation for this change

This is to ensure QT_QPA_PLATFORM_PLUGIN_PATH is set on Darwin.

Fixes #96984

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.

@ofborg ofborg bot added the 6.topic: darwin Running or building packages on Darwin label Sep 2, 2020
Copy link
Contributor

@worldofpeace worldofpeace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrapQtAppsHook exists to do this for us. If you change the deriver from stdenv.mkDerivation to mkDerivation it will add the hook automatically. Also note, while those seem to be named exactly the same, mkDerivation will come from the qt5 attribute set because of the callPackage function (that I believe) this package should be using. You should also condition it's adding on optionals enableQt.

@doronbehar
Copy link
Contributor

wrapQtAppsHook exists to do this for us. If you change the deriver from stdenv.mkDerivation to mkDerivation it will add the hook automatically. Also note, while those seem to be named exactly the same, mkDerivation will come from the qt5 attribute set because of the callPackage function (that I believe) this package should be using. You should also condition it's adding on optionals enableQt.

Correct. But, since octave is an interpreter, and it's build is so heavy, I'd argue we need an external wrapper derivation, so we would also be able to have a octave.withPackages interface, see #65398 and this comment.

I thought I would be able to postpone this until the 6.0.0 release, which I can't wait to get a hold on for a long time now.

Something modeled after wrapNeovim and wrapMpv could be done (see https://github.com/NixOS/nixpkgs/pull/88620/files). This change should also start with this:

diff --git i/pkgs/development/interpreters/octave/default.nix w/pkgs/development/interpreters/octave/default.nix
index 06d69ed8117..e4b527eaa6e 100644
--- i/pkgs/development/interpreters/octave/default.nix
+++ w/pkgs/development/interpreters/octave/default.nix
@@ -148,6 +148,7 @@ stdenv.mkDerivation rec {
   passthru = {
     inherit version;
     sitePath = "share/octave/${version}/site";
+    inherit enableQt enableJIT enableJava enableReadline;
   };
 
   meta = {

@doronbehar
Copy link
Contributor

Maybe double wrapping wouldn't be that bad. I'm experimenting a fix for this on top of octave 6's release candidate.

@doronbehar
Copy link
Contributor

@graham33
Copy link
Contributor Author

@doronbehar that makes sense, thanks. I'll update this PR to just use the right mkDerivation and test that, so we can either choose to merge or wait for a bigger refactoring.

@doronbehar
Copy link
Contributor

@graham33 please, if you'd test this on Darwin it'll be helpful. Something like this should work:

doronbehar@7c6db88

The refactoring I'm working on are for Octave 6, and they come along other changes, so don't wait for me. I also did not find time to test the mkDerivation thing while testing my changes.

@graham33 graham33 force-pushed the fix/96984_octave_darwin_qt_plugin_path branch 2 times, most recently from 4c6daf1 to ce933b2 Compare September 22, 2020 21:40
@graham33
Copy link
Contributor Author

Updated but not yet tested.

This is to ensure QT_QPA_PLATFORM_PLUGIN_PATH is set on Darwin.
@graham33 graham33 force-pushed the fix/96984_octave_darwin_qt_plugin_path branch from ce933b2 to 5416b2d Compare September 23, 2020 20:11
@graham33
Copy link
Contributor Author

I've tested this briefly on Darwin (also on NixOS) and I get a working Octave. For Darwin I had to cherry-pick 8e4e38c from staging to get a working build (it hasn't made it to master yet).

Just to briefly summarise the state of Octave on Darwin (at least from my brief testing, I don't use Darwin day-to-day): with the above fix the GUI works as long as you run with octave --force-gui, and as I mentioned basic editing/calculations/plotting seem to work. There are issues with the system menus sometimes not working, and it tends to hang/crash on exit. I imagine these issues might be improved via a Qt upgrade, but I haven't tried that.

@graham33 graham33 changed the title octave: add wrapper on Darwin to set QT_QPA_PLATFORM_PLUGIN_PATH octave: use qt-5 mkDerivation for wrapQtAppsHook Sep 24, 2020
Copy link
Contributor

@doronbehar doronbehar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LGTM.

jdk = jdk8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731
};
octaveFull = (lowPrio (libsForQt512.callPackage ../development/interpreters/octave {
octaveFull = (lowPrio (libsForQt5.callPackage ../development/interpreters/octave {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd remove the lowPrio along with this change. It's a leftover from quiet some time ago.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done (not really sure if there's anything to be tested, let me know if so).

@doronbehar doronbehar merged commit 31cef85 into NixOS:master Sep 25, 2020
@doronbehar
Copy link
Contributor

Thanks :)

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.

Octave 5.2.0: error finding Qt platform plugin on Darwin
3 participants