8fb885a19e
Qt QML is a language for designing user interfaces. QML (and related JavaScript) source files are compiled into bytecode at runtime before execution. To save time, this bytecode is cached on disk. The cache is keyed primarily off the application name and mtime of the source file. Since application names rarely change, source files that have passed through the store have their mtimes fixed at 1, and SOURCE_DATE_EPOCH is also set to 1 during builds, compiled bytecode in this cache for Qt programs built by Nix is rarely or never invalidated. This results in programs running with QML bytecode that does not match their source code, which manifests as a constant source of random and unreproducible glitches, oddities, and crashes in Qt applications when they are upgraded. For applications like SDDM and Plasma, the user may be left with a completely broken system, and sometimes even rolling back doesn't fix the issue. This patch resolves the issue by simply patching Qt's QML module in all supported versions to disable the disk cache by default as if the environment variable QML_DISABLE_DISK_CACHE were always 1. Patching the code ensures consistent behavior for all Qt applications in all environments, including non-NixOS uses. Simple benchmarking suggests an approximate 10% CPU time penalty when launching QML-heavy applications, and no measurable penalty to booting into Plasma. This is considerably more benign than the earlier behavior. For testing or the performance conscious, use of the cache can be re-enabled after understanding the risks by setting the environment variable QML_FORCE_DISK_CACHE to 1. This can be done system-wide using e.g. the `environment.sessionVariables` NixOS option. Future work could change the cache key through source code changes or automatic generation of an appropriate SOURCE_DATE_EPOCH. Until then, this is a simple change which removes a large class of user frustration and headache for little penalty. |
||
---|---|---|
.. | ||
5.12 | ||
5.14 | ||
5.15 | ||
hooks | ||
modules | ||
mkDerivation.nix | ||
qt-env.nix | ||
qtModule.nix | ||
README.md |
Qt 5 Maintainer's Notes
Minor Updates
Let $major
be the major version number, e.g. 5.9
.
- Change the version number in the
$major/fetch.sh
. - Run
./maintainers/scripts/fetch-kde-qt.sh pkgs/development/libraries/qt-5/$major
from the top of the Nixpkgs tree.
See below if it is necessary to update any patches.
Major Updates
Let $major
be the new major version number, e.g. 5.10
.
- Copy the subdirectory from the previous major version to
$major
. - Change the version number in
$major/fetch.sh
. - Run
./maintainers/scripts/fetch-kde-qt.sh pkgs/development/libraries/qt-5/$major
from the top of the Nixpkgs tree. - Add a top-level attribute in
pkgs/top-level/all-packages.nix
for the new major version. - Change the
qt5
top-level attribute to point to the new major version. - If the previous major version is not a long-term support release, remove it from Nixpkgs.
See below if it is necessary to update any patches.
Patches
Nixpkgs maintains several patches for Qt which cannot be submitted upstream. To facilitate maintenance, a fork of the upstream repository is created for each patched module:
In each repository, the patches are contained in a branch named nixpkgs/$major
for each major version. Please make a pull request to add or update any patch
which will be maintained in Nixpkgs.
The forked repository for each module is used to create a single patch in
Nixpkgs. To recreate the patch for module $module
(e.g. qtbase
) at version
$version
(e.g. 5.9.1
) in the branch $major
(e.g. 5.9
),
- Clone the fork for
$module
from the list above. - Checkout the active branch,
git checkout nixpkgs/$major
. - Compare the patched branch to the release tag,
git diff v$version > $module.patch
. - Copy
$module.patch
into the Nixpkgs tree.
Minor Version Updates
To update module $module
to version $version
from an older version in the
same branch $major
,
- Clone the fork for
$module
from the list above. - Checkout the active branch,
git checkout nixpkgs/$major
. - Merge the new version into the active branch,
git merge --no-ff v$version
. - Fix any conflicts.
- Open a pull request for the changes.
- Follow the instructions above to recreate the module patch in Nixpkgs.
Major Version Updates
To update module $module
from $oldversion
in branch $oldmajor
to version
$version
in branch $major
,
- Clone the fork for
$module
from the list above. - Checkout a new branch for the new major version,
git checkout -b nixpkgs/$major nixpkgs/$oldmajor
. - Rebase the patches from
$oldversion
onto the new branch,git rebase v$oldversion --onto v$version
. - Fix any conflicts.
- Open a pull request for the changes.
- Follow the instructions above to recreate the module patch in Nixpkgs.