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

nixos/qt: set QT_PLUGIN_PATH and QML2_IMPORT_PATH when enabled #211003

Merged
merged 1 commit into from
Jan 16, 2023

Conversation

lilyinstarlight
Copy link
Member

Description of changes

This is needed for installed Qt plugins to be found by Qt6 (and Qt5 seemed to possibly be working by accident rather than intent, so I set those paths here as well)

I can confirm this lets me use adwaita on qgnomeplatform with Qt6 apps

Fixes #210891

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.05 Release Notes (or backporting 22.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Jan 15, 2023
@NickCao
Copy link
Member

NickCao commented Jan 16, 2023

The path should actually be added to environment.profileRelativeSessionVariables, so that plugins installed in user profiles also works. But I was reluctant to do this as it introduces much impurities to nixos. Hope someone could come up with a better idea.

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Jan 16, 2023
@lilyinstarlight
Copy link
Member Author

lilyinstarlight commented Jan 16, 2023

The path should actually be added to environment.profileRelativeSessionVariables, so that plugins installed in user profiles also works. But I was reluctant to do this as it introduces much impurities to nixos. Hope someone could come up with a better idea.

Yeah I originally had written this to set the values directly from the packages to "${drv}/${qt.qtbase.qtPluginPath}" to QT_PLUGIN_PATH, but many other NixOS modules seemed to set stuff like that var to /run/current-system/sw. And setting it like this would make it work better for config switches without having to relog/reboot so I changed it to this before opening the PR

Also qt5 was already pulling from PATH impurely to search /run/current-system/sw (and that seems to have been the only reason qt5 styles were ever applied to begin with)

Those issues aside, I do not feel strongly if you or anyone else has a better idea to implement this or would prefer something else

@NickCao
Copy link
Member

NickCao commented Jan 16, 2023

I'm happy to merge this, just update it to use environment.profileRelativeSessionVariables as in nixos/modules/programs/environment.nix

@NickCao NickCao merged commit 7ace936 into NixOS:master Jan 16, 2023
@lilyinstarlight lilyinstarlight deleted the fix/qt6-plugin-path branch January 16, 2023 12:10
@aviallon
Copy link
Contributor

This causes issues when a package uses another Qt library version, as when you pull one specific package from nixos-unstable.

@lilyinstarlight
Copy link
Member Author

lilyinstarlight commented Apr 26, 2023

This causes issues when a package uses another Qt library version, as when you pull one specific package from nixos-unstable.

Is this an issue distinct from #227795? If so, can you open a new issue and describe what you are experiencing?

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/gpt4all-nix-derivation/27744/3

@Misterio77
Copy link
Member

I wonder if this should be added even when qt.enable is false? Adding qt6 plugins to my environment should make them work, similarly to qt{4,5} and GTK{2,3,4}.

My usecase is adding qt6 plugins (e.g. #245571) to my home-manager config (using qt.* options), while my NixOS configuration does not have anything qt related enabled.

@Misterio77 Misterio77 mentioned this pull request Jul 26, 2023
12 tasks
@aviallon
Copy link
Contributor

@lilyinstarlight Yes, it is different. It also happens when one application / dependency uses a patched Qt, especially if using a derivation from nixpkgs-unstable on a nixos-23.05 system

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

QT_PLUGIN_PATH is broken, Qt6 applications can't find adwaita-qt
5 participants