-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
Wrap Qt applications #54525
Wrap Qt applications #54525
Conversation
I kind of thought that was an intentional design decision in qt infra to allow different qt runtimes… This goes back to the debate on wrapping vs propagatedUserEnvPkgs. Wrapping seems like a simpler way to do things to me, but I’m not sure if everyone agrees. See discussion on this issue by @edolstra: |
Dynamically loading Qt plugins at runtime is intentional, and this pull request does not alter that. This pull request addresses the fact that it is much, much too easy to mix Qt versions--which always ends badly. |
@ttuegel would this help also for proprietary binaries, where Qt is patched into binary with |
@danbst This alone would not help the situation with binary distributions, but it would help not to put everything into |
Is there any reason we don't make |
@peterhoeg this still won't fix packages outside KDE world, and there's a lot of QT applications out there - so I really prefer the approach in #44047 not requiring any wrapper. |
Sorry if I sound grumpy or mad, but it's not my intention in the comment. Read the following in a neutral voice. I may be out of line here (and definitely biased), but "similar to Fixing the issues in the libraries directly would ensure no one has to remember to use that one hook on their software, and fixes the issue closer to the source, instead of papering over. The main issue being that most of the time not adding the hook works fine. There wouldn't be much of a developer experience (DX?) issue if it failed noisily in all circumstances when the hook is missing. I have one concession to make to those wrappers: they require much less effort to maintain. Solving this particular issue at the root isn't really intrusive, and relatively self-contained, but I guess it's half part to good software and half part to luck. |
@peterhoeg I haven't tried that, but it should be OK. EDIT: For that matter, I don't see any reason not add |
@samueldr |
#44047 is a lot more invasive and I for one simply don't know enough about Qt internals to be able to say anything remotely intelligent about the viability of that approach. This PR (with the
Why don't we move ahead with this for now while working on #44047? |
Thanks for the effort! I just recently thought of trying the exact same thing before I found this issue :). |
@ttuegel pinging on this. Hoping we can get this in soon as it closes quite a few other issues around this. |
49959c7
to
e752538
Compare
Similar to pkgs.bitcoin, QT_PLUGIN_PATH is required in checkPhase to run the "testcli" test (ironically).
keepassxc: partial revert of NixOS#54525 (fix build)
Regression introduced in NixOS#54525, tracked in NixOS#65399.
Use mkDerivation has instead of stdenv.mkDerivation (see NixOS#54525).
This commit fixes the error: Could not find the Qt platform plugin "xcb" in "" See NixOS#54525 and NixOS#56921
This caused significant closure size increases, see #69272. |
To be honest the Possibly better approach: only add those packages to |
The wrapper hook is designed only to pick up host dependencies, so I really don't understand why As far as Qt is concerned, the correct solution is to comply with FHS so that resources have well-known canonical names, but that's not an option here.
I think it is unlikely that this would work because the Qt/KDE folks strongly prefer dynamic dependencies, but for the sake of argument, how can we detect during the build what packages are in the runtime closure? |
That doesn't prevent capturing Anyway, a short-term fix might be:
Probably looking at the RPATH ( |
It prevents capturing build tools like
We already select specific required paths in the setup hook, which should also eliminate
This will break at least packages that: use plugins, use QML, or have kservice (D-Bus) dependencies.
This seems like a reasonable course of action. |
Introduces
wrapQtAppsHook
similar towrapGAppsHook
to solve long-standing problems with Qt applications, particularly plugin search paths. Wrapped Qt applications can run directly from the Nix store without being installed and usingnix-shell --pure
. (Actually, applications that use OpenGL on NixOS cannot run from pure Nix shells because of Mesa; this is solved by settingLD_LIBRARY_PATH
for the OpenGL drivers. I did not address this here because it is not a Qt problem.)This does not apply the hook to every application. My intent is that package maintainers can make those changes can be merged to
master
. Ultimately, the burden of interactive testing will fall on them anyway. This is just the changes to Qt necessary to make that possible. Ark and Okular are wrapped, as proof-of-concept.This also does not remove the patches from Qt that infers plugin and QML paths from
PATH
; that is still necessary for desktop environments (particularly themes) to work as expected. I worked on this pull request for more than a year, but I am still no closer to getting rid of that patch. Finally I decided to rip out everything but the simplest version of the wrapper. For the time being, we can use both the wrapper and the patch together; the latter is inelegant, but everyone's applications will work.This would close #44047, as it addresses the same issue, but more completely: it solves problems with
QT_PLUGIN_PATH
,QML2_IMPORT_PATH
,XDG_DATA_DIRS
and others.Closes: #53750, #44047, #51597, #42864 (probably others)
TODO: closure size analysis and documentation
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)