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

rapid-photo-downloader: fix QT wrapping #66322

Merged

Conversation

lightbulbjim
Copy link
Contributor

Motivation for this change

Fixing QT wrapping as per #65399. Wrapping is done manually as this is a Python app. To be honest I'm not sure if this is the right approach, but it works. Suggestions welcome.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • 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 nix-review --run "nix-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.
Notify maintainers

cc @jfrankenau

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.

See qutebrowser with as an example of how to do this. (the mkDerivationWith part)
And please wrap in preFixup.

@lightbulbjim
Copy link
Contributor Author

I'm a bit stuck with how to proceed. Moving the wrapping to preFixup/postFixup is fine, but I'm not sure what using mkDerivationWith buys me.

Also, from my understanding the way forward is to use declarative wrappers, however if I use wrapQtAppsHook then I end up setting dontWrapQtApps = true and manually calling wrapProgram anyway.

Finally, I can't find a way to avoid double-wrapping the binaries (once for Python libs, once for QT). But that just seems to be the way it works at the moment.

Between the wrappers being reworked and the recent QT changes it's sometimes hard to differentiate between "new best practices" and deprecated patterns :-).

@lightbulbjim lightbulbjim force-pushed the rapid-photo-downloader-wrapping branch from 7b2eb8c to f63793a Compare August 10, 2019 10:11
@lightbulbjim
Copy link
Contributor Author

Does that look reasonable? I must admit I don't entirely understand which is the desired approach so I'm cargo culting from other derivations a little. It works though.

@worldofpeace
Copy link
Contributor

We can avoid the double wrapping safely by doing this instead:

add

 "\${qtWrapperArgs[@]}"

to makeWrapperArgs. That way the wrapper that buildPythonApplication creates will have all the arguments from qt's setup hook.

Also you don't need to include wrapQtAppsHook when using mkDerivationWith since it'll include it automatically.

@lightbulbjim lightbulbjim force-pushed the rapid-photo-downloader-wrapping branch from f63793a to 6fd50e2 Compare August 10, 2019 11:29
@lightbulbjim
Copy link
Contributor Author

We can avoid the double wrapping safely by doing this instead:

add

 "\${qtWrapperArgs[@]}"

to makeWrapperArgs. That way the wrapper that buildPythonApplication creates will have all the arguments from qt's setup hook.

Nifty! I was just trying to do this on another similar package but it was failing because I wasn't escaping the sigil. Thanks!

Also you don't need to include wrapQtAppsHook when using mkDerivationWith since it'll include it automatically.

Yeah, I just found some docs I hadn't seen before which explained this. Then looking at the source it's starting to make sense. The names were confusing me (eg it wasn't immediately obvious that mkDerivationWith is a QT specific thing just from its name).

Anyway, updated and it looks much cleaner now. Thanks for the pointers.

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.

Builds and executes for me. I inspected the wrappers on the binaries and they have the arguments from wrapQtAppsHook.

@worldofpeace worldofpeace force-pushed the rapid-photo-downloader-wrapping branch from 6fd50e2 to 2f1b92d Compare August 10, 2019 12:00
@worldofpeace worldofpeace merged commit 63f0c69 into NixOS:master Aug 10, 2019
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