From 8f48e1cadbacb530571d969e07233aef68908cf0 Mon Sep 17 00:00:00 2001 From: K900 Date: Tue, 3 Jan 2023 15:38:02 +0300 Subject: [PATCH 1/2] doc/languages-frameworks/qt: remove outdated information --- doc/languages-frameworks/qt.section.md | 72 +------------------------- 1 file changed, 2 insertions(+), 70 deletions(-) diff --git a/doc/languages-frameworks/qt.section.md b/doc/languages-frameworks/qt.section.md index 986deeb0d4b..696031268ed 100644 --- a/doc/languages-frameworks/qt.section.md +++ b/doc/languages-frameworks/qt.section.md @@ -2,14 +2,9 @@ Writing Nix expressions for Qt libraries and applications is largely similar as for other C++ software. This section assumes some knowledge of the latter. -There are two problems that the Nixpkgs Qt infrastructure addresses, -which are not shared by other C++ software: -1. There are usually multiple supported versions of Qt in Nixpkgs. - All of a package's dependencies must be built with the same version of Qt. - This is similar to the version constraints imposed on interpreted languages like Python. -2. Qt makes extensive use of runtime dependency detection. - Runtime dependencies are made into build dependencies through wrappers. +However, Qt makes extensive use of runtime dependency detection. +In nixpkgs, those runtime dependencies are made into build dependencies through wrappers. ## Nix expression for a Qt package (default.nix) {#qt-default-nix} @@ -95,66 +90,3 @@ stdenv.mkDerivation { This means that scripts won't be automatically wrapped so you'll need to manually wrap them as previously mentioned. An example of when you'd always need to do this is with Python applications that use PyQt. ::: - -## Adding a library to Nixpkgs {#adding-a-library-to-nixpkgs} - -Add Qt libraries to `qt5-packages.nix` to make them available for every -supported Qt version. - -### Example adding a Qt library {#qt-library-all-packages-nix} - -The following represents the contents of `qt5-packages.nix`. - -```nix -{ - # ... - - mylib = callPackage ../path/to/mylib {}; - - # ... -} -``` - -Libraries are built with every available version of Qt. -Use the `meta.broken` attribute to disable the package for unsupported Qt versions: - -```nix -{ stdenv, lib, qtbase }: - -stdenv.mkDerivation { - # ... - # Disable this library with Qt < 5.9.0 - meta.broken = lib.versionOlder qtbase.version "5.9.0"; -} -``` - -## Adding an application to Nixpkgs {#adding-an-application-to-nixpkgs} - -Add Qt applications to `qt5-packages.nix`. Add an alias to `all-packages.nix` -to select the Qt 5 version used for the application. - -### Example adding a Qt application {#qt-application-all-packages-nix} - -The following represents the contents of `qt5-packages.nix`. - -```nix -{ - # ... - - myapp = callPackage ../path/to/myapp {}; - - # ... -} -``` - -The following represents the contents of `all-packages.nix`. - -```nix -{ - # ... - - myapp = libsForQt5.myapp; - - # ... -} -``` From bf5a65096c94da69551d8b8f6274385eba062e35 Mon Sep 17 00:00:00 2001 From: K900 Date: Tue, 3 Jan 2023 15:39:40 +0300 Subject: [PATCH 2/2] pkgs/all-packages: remove unused alias, add comment --- doc/languages-frameworks/qt.section.md | 6 ++++-- pkgs/top-level/all-packages.nix | 5 +---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/doc/languages-frameworks/qt.section.md b/doc/languages-frameworks/qt.section.md index 696031268ed..e09194e391e 100644 --- a/doc/languages-frameworks/qt.section.md +++ b/doc/languages-frameworks/qt.section.md @@ -3,8 +3,10 @@ Writing Nix expressions for Qt libraries and applications is largely similar as for other C++ software. This section assumes some knowledge of the latter. -However, Qt makes extensive use of runtime dependency detection. -In nixpkgs, those runtime dependencies are made into build dependencies through wrappers. +The major caveat with Qt applications is that Qt uses a plugin system to load additional modules at runtime, +from a list of well-known locations. In Nixpkgs, we patch QtCore to instead use an environment variable, +and wrap Qt applications to set it to the right paths. This effectively makes the runtime dependencies +pure and explicit at build-time, at the cost of introducing an extra indirection. ## Nix expression for a Qt package (default.nix) {#qt-default-nix} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3dbe4491b0f..8ff5ca883e5 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -22393,6 +22393,7 @@ with pkgs; }); # TODO: remove once no package needs this anymore or together with OpenSSL 1.1 + # Current users: mumble, murmur qt5_openssl_1_1 = qt5.overrideScope' (_: super: { qtbase = super.qtbase.override { openssl = openssl_1_1; @@ -22402,10 +22403,6 @@ with pkgs; }; }; }); - libsForQt5_openssl_1_1 = import ./qt5-packages.nix { - inherit lib pkgs; - qt5 = qt5_openssl_1_1; - }; # plasma5Packages maps to the Qt5 packages set that is used to build the plasma5 desktop plasma5Packages = libsForQt5;