push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
{
lib,
qtModule,
qtbase,
qtdeclarative,
qtmultimedia,
assimp,
}:
qtModule {
pname = "qt3d";
# make absolutely sure the vendored assimp is not used
# patch cmake to accept assimp 6.x versions
postPatch = ''
rm -rf src/3rdparty/assimp/src
substituteInPlace src/core/configure.cmake --replace-fail "WrapQt3DAssimp 5" "WrapQt3DAssimp 6"
'';
propagatedBuildInputs = [
qtbase
qtdeclarative
qtmultimedia
assimp
];
cmakeFlags = [
(lib.cmakeBool "FEATURE_qt3d_system_assimp" true) # use nix assimp
(lib.cmakeBool "TEST_assimp" true) # required for internal cmake asserts
];
}

View File

@@ -0,0 +1,21 @@
{
qtModule,
qtbase,
qtdeclarative,
libiconv,
icu,
openssl,
}:
qtModule {
pname = "qt5compat";
propagatedBuildInputs = [
qtbase
qtdeclarative
];
buildInputs = [
libiconv
icu
openssl
];
}

View File

@@ -0,0 +1,11 @@
--- a/cmake/QtBuildPathsHelpers.cmake
+++ b/cmake/QtBuildPathsHelpers.cmake
@@ -140,7 +140,7 @@ function(qt_configure_process_path name default docstring)
set(new_value ".")
elseif(rel_path MATCHES "^\.\./")
# INSTALL_SYSCONFDIR is allowed to be outside the prefix.
- if(NOT name STREQUAL "INSTALL_SYSCONFDIR")
+ if(NOT (name STREQUAL "INSTALL_SYSCONFDIR" OR name STREQUAL "INSTALL_TRANSLATIONSDIR"))
message(FATAL_ERROR
"Path component '${name}' is outside computed install prefix: ${rel_path} ")
endif()

View File

@@ -0,0 +1,325 @@
{
stdenv,
lib,
src,
version,
bison,
flex,
gperf,
lndir,
perl,
pkg-config,
which,
cmake,
ninja,
libproxy,
xorg,
zstd,
double-conversion,
util-linux,
systemd,
systemdSupport ? stdenv.hostPlatform.isLinux,
libb2,
md4c,
mtdev,
lksctp-tools,
libselinux,
libsepol,
vulkan-headers,
vulkan-loader,
libthai,
libdrm,
libdatrie,
lttng-ust,
libepoxy,
dbus,
fontconfig,
freetype,
glib,
harfbuzz,
icu,
libX11,
libXcomposite,
libXext,
libXi,
libXrender,
libjpeg,
libpng,
libxcb,
libxkbcommon,
libxml2,
libxslt,
openssl,
pcre2,
sqlite,
udev,
xcbutil,
xcbutilimage,
xcbutilkeysyms,
xcbutilrenderutil,
xcbutilwm,
zlib,
at-spi2-core,
unixODBC,
unixODBCDrivers,
libGL,
# darwin
moltenvk,
moveBuildTree,
darwinVersionInputs,
xcbuild,
# mingw
pkgsBuildBuild,
# optional dependencies
cups,
libmysqlclient,
libpq,
withGtk3 ? false,
gtk3,
withLibinput ? false,
libinput,
# options
qttranslations ? null,
}:
let
isCrossBuild = !stdenv.buildPlatform.canExecute stdenv.hostPlatform;
in
stdenv.mkDerivation rec {
pname = "qtbase";
inherit src version;
propagatedBuildInputs = [
libxml2
libxslt
openssl
sqlite
zlib
libGL
vulkan-headers
vulkan-loader
# Text rendering
harfbuzz
icu
# Image formats
libjpeg
libpng
pcre2
zstd
libb2
md4c
double-conversion
]
++ lib.optionals (!stdenv.hostPlatform.isMinGW) [
libproxy
dbus
glib
# unixODBC drivers
unixODBC
unixODBCDrivers.psql
unixODBCDrivers.sqlite
unixODBCDrivers.mariadb
]
++ lib.optionals systemdSupport [
systemd
]
++ lib.optionals stdenv.hostPlatform.isLinux [
util-linux
mtdev
lksctp-tools
libselinux
libsepol
lttng-ust
libthai
libdrm
libdatrie
udev
# Text rendering
fontconfig
freetype
# X11 libs
libX11
libXcomposite
libXext
libXi
libXrender
libxcb
libxkbcommon
xcbutil
xcbutilimage
xcbutilkeysyms
xcbutilrenderutil
xcbutilwm
xorg.libXdmcp
xorg.libXtst
xorg.xcbutilcursor
libepoxy
]
++ lib.optional (cups != null && lib.meta.availableOn stdenv.hostPlatform cups) cups;
buildInputs =
lib.optionals (lib.meta.availableOn stdenv.hostPlatform at-spi2-core) [
at-spi2-core
]
++ lib.optionals stdenv.hostPlatform.isDarwin (darwinVersionInputs ++ [ moltenvk ])
++ lib.optional withGtk3 gtk3
++ lib.optional withLibinput libinput
++ lib.optional (libmysqlclient != null && !stdenv.hostPlatform.isMinGW) libmysqlclient
++ lib.optional (libpq != null && lib.meta.availableOn stdenv.hostPlatform libpq) libpq;
nativeBuildInputs = [
bison
flex
gperf
lndir
perl
pkg-config
which
cmake
ninja
]
++ lib.optionals stdenv.hostPlatform.isDarwin [ moveBuildTree ];
propagatedNativeBuildInputs = [
lndir
]
# Im not sure if this is necessary, but the macOS mkspecs stuff
# tries to call `xcrun xcodebuild`, so better safe than sorry.
++ lib.optionals stdenv.hostPlatform.isDarwin [ xcbuild ];
strictDeps = true;
enableParallelBuilding = true;
patches = [
# look for Qt plugins in directories on PATH
./derive-plugin-load-path-from-PATH.patch
# allow translations to be found outside of install prefix, as is the case in our split builds
./allow-translations-outside-prefix.patch
# always link to libraries by name in qmake-generated build scripts
./qmake-always-use-libname.patch
# always explicitly list includedir in qmake-generated pkg-config files
./qmake-fix-includedir.patch
# don't generate SBOM files by default, they don't work with our split installs anyway
./no-sbom.patch
# use cmake from PATH in qt-cmake wrapper, to avoid qtbase runtime-depending on cmake
./use-cmake-from-path.patch
# macdeployqt fixes
# get qmlimportscanner location from environment variable
./find-qmlimportscanner.patch
# pass QML2_IMPORT_PATH from environment to qmlimportscanner
./qmlimportscanner-import-path.patch
# don't pass qtbase's QML directory to qmlimportscanner if it's empty
./skip-missing-qml-directory.patch
];
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
# TODO: Verify that this catches all the occurrences?
for file in \
cmake/QtPublicAppleHelpers.cmake \
mkspecs/features/mac/asset_catalogs.prf \
mkspecs/features/mac/default_pre.prf \
mkspecs/features/mac/sdk.mk \
mkspecs/features/mac/sdk.prf \
mkspecs/features/permissions.prf \
src/corelib/Qt6CoreMacros.cmake
do
substituteInPlace "$file" \
--replace-quiet /usr/bin/xcrun '${lib.getExe' xcbuild "xcrun"}' \
--replace-quiet /usr/bin/xcode-select '${lib.getExe' xcbuild "xcode-select"}' \
--replace-quiet /usr/libexec/PlistBuddy '${lib.getExe' xcbuild "PlistBuddy"}'
done
substituteInPlace mkspecs/common/macx.conf \
--replace-fail 'CONFIG += ' 'CONFIG += no_default_rpath '
'';
fix_qt_builtin_paths = ../../hooks/fix-qt-builtin-paths.sh;
fix_qt_module_paths = ../../hooks/fix-qt-module-paths.sh;
preHook = ''
. "$fix_qt_builtin_paths"
. "$fix_qt_module_paths"
'';
qtPluginPrefix = "lib/qt-6/plugins";
qtQmlPrefix = "lib/qt-6/qml";
cmakeFlags = [
"-DQT_EMBED_TOOLCHAIN_COMPILER=OFF"
"-DINSTALL_PLUGINSDIR=${qtPluginPrefix}"
"-DINSTALL_QMLDIR=${qtQmlPrefix}"
"-DQT_FEATURE_libproxy=ON"
"-DQT_FEATURE_system_sqlite=ON"
"-DQT_FEATURE_openssl_linked=ON"
"-DQT_FEATURE_vulkan=ON"
# don't leak OS version into the final output
# https://bugreports.qt.io/browse/QTBUG-136060
"-DCMAKE_SYSTEM_VERSION="
]
++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
"-DQT_FEATURE_sctp=ON"
"-DQT_FEATURE_journald=${if systemdSupport then "ON" else "OFF"}"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
"-DQT_FEATURE_rpath=OFF"
"-DQT_NO_XCODE_MIN_VERSION_CHECK=ON"
# This is only used for the min version check, which we disabled above.
# When this variable is not set, cmake tries to execute xcodebuild
# to query the version.
"-DQT_INTERNAL_XCODE_VERSION=0.1"
]
++ lib.optionals isCrossBuild [
"-DQT_HOST_PATH=${pkgsBuildBuild.qt6.qtbase}"
"-DQt6HostInfo_DIR=${pkgsBuildBuild.qt6.qtbase}/lib/cmake/Qt6HostInfo"
]
++ lib.optional (
qttranslations != null && !isCrossBuild
) "-DINSTALL_TRANSLATIONSDIR=${qttranslations}/translations";
env.NIX_CFLAGS_COMPILE = "-DNIXPKGS_QT_PLUGIN_PREFIX=\"${qtPluginPrefix}\"";
outputs = [
"out"
"dev"
];
separateDebugInfo = true;
moveToDev = false;
postFixup = ''
moveToOutput "mkspecs/modules" "$dev"
fixQtModulePaths "$dev/mkspecs/modules"
fixQtBuiltinPaths "$out" '*.pr?'
''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
# FIXME: not sure why this isn't added automatically?
patchelf --add-rpath "${libmysqlclient}/lib/mariadb" $out/${qtPluginPrefix}/sqldrivers/libqsqlmysql.so
patchelf --add-rpath "${vulkan-loader}/lib" --add-needed "libvulkan.so" $out/lib/libQt6Gui.so
'';
dontWrapQtApps = true;
setupHook = ../../hooks/qtbase-setup-hook.sh;
meta = with lib; {
homepage = "https://www.qt.io/";
description = "Cross-platform application framework for C++";
license = with licenses; [
fdl13Plus
gpl2Plus
lgpl21Plus
lgpl3Plus
];
maintainers = with maintainers; [
nickcao
LunNova
];
platforms = platforms.unix ++ platforms.windows;
};
}

View File

@@ -0,0 +1,18 @@
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -3038,6 +3038,15 @@ QStringList QCoreApplication::libraryPathsLocked()
app_libpaths->append(installPathPlugins);
}
+ // Add library paths derived from PATH
+ const QStringList paths = QFile::decodeName(qgetenv("PATH")).split(QStringLiteral(":"));
+ const QString plugindir = QStringLiteral("../" NIXPKGS_QT_PLUGIN_PREFIX);
+ for (const QString &path: paths) {
+ if (!path.isEmpty()) {
+ app_libpaths->append(QDir::cleanPath(path + QDir::separator() + plugindir));
+ }
+ }
+
// If QCoreApplication is not yet instantiated,
// make sure we add the application path when we construct the QCoreApplication
if (self) self->d_func()->appendApplicationPathToLibraryPaths();

View File

@@ -0,0 +1,13 @@
--- a/src/tools/macdeployqt/shared/shared.cpp
+++ b/src/tools/macdeployqt/shared/shared.cpp
@@ -1280,6 +1280,10 @@ bool deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInf
if (!QFile::exists(qmlImportScannerPath))
qmlImportScannerPath = QCoreApplication::applicationDirPath() + "/qmlimportscanner";
+ // Fallback: Pass qml import scanner via environment variable
+ if (!QFile::exists(qmlImportScannerPath))
+ qmlImportScannerPath = ::qgetenv("NIX_QMLIMPORTSCANNER");
+
// Verify that we found a qmlimportscanner binary
if (!QFile::exists(qmlImportScannerPath)) {
LogError() << "qmlimportscanner not found at" << qmlImportScannerPath;

View File

@@ -0,0 +1,13 @@
diff --git a/cmake/QtPublicSbomHelpers.cmake b/cmake/QtPublicSbomHelpers.cmake
index 3767fb4ff26..b642ea3e4b6 100644
--- a/cmake/QtPublicSbomHelpers.cmake
+++ b/cmake/QtPublicSbomHelpers.cmake
@@ -369,7 +369,7 @@ function(_qt_internal_setup_sbom)
endif()
option(QT_GENERATE_SBOM "Generate SBOM documents in SPDX v2.3 tag:value format."
- "${default_value}")
+ OFF)
string(CONCAT help_string
"Generate SBOM documents in SPDX v2.3 JSON format if required python dependency "

View File

@@ -0,0 +1,28 @@
--- a/cmake/QtFinishPrlFile.cmake
+++ b/cmake/QtFinishPrlFile.cmake
@@ -69,9 +69,10 @@ foreach(line ${lines})
endif()
list(APPEND adjusted_libs "-framework" "${CMAKE_MATCH_1}")
else()
- # Not a framework, transform the Qt module into relocatable relative path.
- qt_strip_library_version_suffix(relative_lib "${relative_lib}")
- list(APPEND adjusted_libs "$$[QT_INSTALL_LIBS]/${relative_lib}")
+ # Not a framework, extract the library name and prepend an -l to make
+ # it relocatable.
+ qt_transform_absolute_library_paths_to_link_flags(lib_with_link_flag "${lib}")
+ list(APPEND adjusted_libs "${lib_with_link_flag}")
endif()
endif()
else()
--- a/cmake/QtGenerateLibHelpers.cmake
+++ b/cmake/QtGenerateLibHelpers.cmake
@@ -82,9 +82,6 @@ function(qt_transform_absolute_library_paths_to_link_flags out_var library_path_
# If library_path isn't in default link directories, we should add it to link flags.
# But we shouldn't add it duplicately.
list(FIND IMPLICIT_LINK_DIRECTORIES_LOWER "${dir_lower}" index)
- if(index EQUAL -1 AND NOT "-L\"${dir}\"" IN_LIST out_list)
- list(APPEND out_list "-L\"${dir}\"")
- endif()
endif()
list(APPEND out_list "${lib_name_with_link_flag}")
else()

View File

@@ -0,0 +1,12 @@
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -3412,8 +3412,7 @@ MakefileGenerator::writePkgConfigFile()
<< varGlue("QMAKE_PKGCONFIG_CFLAGS", "", " ", " ")
// << varGlue("DEFINES","-D"," -D"," ")
;
- if (!project->values("QMAKE_DEFAULT_INCDIRS").contains(includeDir))
- t << "-I${includedir}";
+ t << "-I${includedir}";
if (target_mode == TARG_MAC_MODE && project->isActiveConfig("lib_bundle")
&& libDir != QLatin1String("/Library/Frameworks")) {
t << " -F${libdir}";

View File

@@ -0,0 +1,16 @@
--- a/src/tools/macdeployqt/shared/shared.cpp
+++ b/src/tools/macdeployqt/shared/shared.cpp
@@ -1300,6 +1300,13 @@ bool deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInf
argumentList.append( "-importPath");
argumentList.append(qmlImportsPath);
+ // In a modularized installation of qt as we have in Nix, instead, we will
+ // read the paths from the environment, as they are spread in multiple
+ // locations and normally set in the environment like this
+ auto envQmlImportPaths = ::qgetenv("QML2_IMPORT_PATH").split(':');
+ for (const QString &importPath : envQmlImportPaths)
+ argumentList << "-importPath" << importPath;
+
// run qmlimportscanner
QProcess qmlImportScanner;
qmlImportScanner.start(qmlImportScannerPath, argumentList);

View File

@@ -0,0 +1,17 @@
--- a/src/tools/macdeployqt/shared/shared.cpp
+++ b/src/tools/macdeployqt/shared/shared.cpp
@@ -1300,9 +1300,12 @@ bool deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInf
}
for (const QString &importPath : qmlImportPaths)
argumentList << "-importPath" << importPath;
+
QString qmlImportsPath = QLibraryInfo::path(QLibraryInfo::QmlImportsPath);
- argumentList.append( "-importPath");
- argumentList.append(qmlImportsPath);
+ if (QFile::exists(qmlImportsPath)) {
+ argumentList.append( "-importPath");
+ argumentList.append(qmlImportsPath);
+ }
// In a modularized installation of qt as we have in Nix, instead, we will
// read the paths from the environment, as they are spread in multiple

View File

@@ -0,0 +1,34 @@
--- a/bin/qt-cmake-create.in
+++ b/bin/qt-cmake-create.in
@@ -7,12 +7,7 @@ HELP_MESSAGE="Usage
script_dir_path=`dirname $0`
script_dir_path=`(cd "$script_dir_path"; /bin/pwd)`
-# Try to use original cmake, otherwise to make it relocatable, use any cmake found in PATH.
-original_cmake_path="@CMAKE_COMMAND@"
-cmake_path=$original_cmake_path
-if ! test -f "$cmake_path"; then
- cmake_path="cmake"
-fi
+cmake_path="cmake"
if [ "$#" -gt 1 ]; then
echo "Invalid number of arguments"
diff --git a/bin/qt-cmake.in b/bin/qt-cmake.in
index f719257f602..571ffe788fa 100755
--- a/bin/qt-cmake.in
+++ b/bin/qt-cmake.in
@@ -4,12 +4,7 @@
script_dir_path=`dirname $0`
script_dir_path=`(cd "$script_dir_path"; /bin/pwd)`
-# Try to use original cmake, otherwise to make it relocatable, use any cmake found in PATH.
-original_cmake_path="@CMAKE_COMMAND@"
-cmake_path=$original_cmake_path
-if ! test -f "$cmake_path"; then
- cmake_path="cmake"
-fi
+cmake_path="cmake"
toolchain_path="$script_dir_path/@__GlobalConfig_relative_path_from_bin_dir_to_cmake_config_dir@/qt.toolchain.cmake"

View File

@@ -0,0 +1,13 @@
{
qtModule,
qtbase,
qtdeclarative,
}:
qtModule {
pname = "qtcharts";
propagatedBuildInputs = [
qtbase
qtdeclarative
];
}

View File

@@ -0,0 +1,19 @@
{
qtModule,
lib,
stdenv,
qtbase,
qtdeclarative,
bluez,
pkg-config,
}:
qtModule {
pname = "qtconnectivity";
nativeBuildInputs = [ pkg-config ];
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ bluez ];
propagatedBuildInputs = [
qtbase
qtdeclarative
];
}

View File

@@ -0,0 +1,13 @@
{
qtModule,
qtbase,
qtdeclarative,
}:
qtModule {
pname = "qtdatavis3d";
propagatedBuildInputs = [
qtbase
qtdeclarative
];
}

View File

@@ -0,0 +1,67 @@
{
qtModule,
qtbase,
qtlanguageserver,
qtshadertools,
qtsvg,
openssl,
darwin,
stdenv,
lib,
pkgsBuildBuild,
replaceVars,
}:
qtModule {
pname = "qtdeclarative";
propagatedBuildInputs = [
qtbase
qtlanguageserver
qtshadertools
qtsvg
openssl
];
strictDeps = true;
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
darwin.sigtool
];
patches = [
# invalidates qml caches created from nix applications at different
# store paths and disallows saving caches of bare qml files in the store.
(replaceVars ./invalidate-caches-from-mismatched-store-paths.patch {
nixStore = builtins.storeDir;
nixStoreLength = toString ((builtins.stringLength builtins.storeDir) + 1); # trailing /
})
# add version specific QML import path
./use-versioned-import-path.patch
];
preConfigure =
let
storePrefixLen = toString ((builtins.stringLength builtins.storeDir) + 1);
in
''
# "NIX:" is reserved for saved qmlc files in patch 0001, "QTDHASH:" takes the place
# of the old tag, which is otherwise the qt version, invalidating caches from other
# qtdeclarative store paths.
echo "QTDHASH:''${out:${storePrefixLen}:32}" > .tag
'';
cmakeFlags = [
"-DQt6ShaderToolsTools_DIR=${pkgsBuildBuild.qt6.qtshadertools}/lib/cmake/Qt6ShaderTools"
# for some reason doesn't get found automatically on Darwin
"-DPython_EXECUTABLE=${lib.getExe pkgsBuildBuild.python3}"
]
# Conditional is required to prevent infinite recursion during a cross build
++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
"-DQt6QmlTools_DIR=${pkgsBuildBuild.qt6.qtdeclarative}/lib/cmake/Qt6QmlTools"
];
meta.maintainers = with lib.maintainers; [
nickcao
outfoxxed
];
}

View File

@@ -0,0 +1,112 @@
diff --git a/src/qml/common/qv4compileddata.cpp b/src/qml/common/qv4compileddata.cpp
index 9dee91f713..9dec5cae67 100644
--- a/src/qml/common/qv4compileddata.cpp
+++ b/src/qml/common/qv4compileddata.cpp
@@ -15,6 +15,8 @@
#include <QtCore/qscopeguard.h>
#include <QtCore/qstandardpaths.h>
+#include <QtCore/qcoreapplication.h>
+
static_assert(QV4::CompiledData::QmlCompileHashSpace > QML_COMPILE_HASH_LENGTH);
#if defined(QML_COMPILE_HASH) && defined(QML_COMPILE_HASH_LENGTH) && QML_COMPILE_HASH_LENGTH > 0
@@ -26,6 +28,35 @@ __attribute__((section(".qml_compile_hash")))
const char qml_compile_hash[QV4::CompiledData::QmlCompileHashSpace] = QML_COMPILE_HASH;
static_assert(sizeof(QV4::CompiledData::Unit::libraryVersionHash) > QML_COMPILE_HASH_LENGTH,
"Compile hash length exceeds reserved size in data structure. Please adjust and bump the format version");
+
+bool nix__isNixApplication() {
+ static const bool value = QCoreApplication::applicationFilePath().startsWith(QStringLiteral("@nixStore@"));
+ return value;
+}
+
+static_assert(sizeof(QV4::CompiledData::Unit::libraryVersionHash) >
+ /*sha1*/ 20 + /*NIX:*/ 4,
+ "Nix compile hash length exceeds the reserved space in data "
+ "structure. Please review the patch.");
+
+const QByteArray &nix__applicationHash() {
+ static const QByteArray value = [](){
+ QCryptographicHash applicationHash(QCryptographicHash::Sha1);
+ applicationHash.addData(QByteArrayView(qml_compile_hash, QML_COMPILE_HASH_LENGTH));
+
+ // We only care about the package, not the specific file path.
+ auto view = QCoreApplication::applicationFilePath().sliced(@nixStoreLength@);
+ auto pkgEndIdx = view.indexOf(QStringLiteral("/"));
+ if (pkgEndIdx != -1) view = view.sliced(0, pkgEndIdx);
+
+ applicationHash.addData(view.toUtf8());
+
+ return QByteArray("NIX:") + applicationHash.result();
+ }();
+
+ return value;
+}
+
#else
# error "QML_COMPILE_HASH must be defined for the build of QtDeclarative to ensure version checking for cache files"
#endif
@@ -69,13 +100,29 @@ bool Unit::verifyHeader(QDateTime expectedSourceTimeStamp, QString *errorString)
}
#if defined(QML_COMPILE_HASH) && defined(QML_COMPILE_HASH_LENGTH) && QML_COMPILE_HASH_LENGTH > 0
- if (qstrncmp(qml_compile_hash, libraryVersionHash, QML_COMPILE_HASH_LENGTH) != 0) {
+ const bool nixUnit = qstrncmp("NIX:", this->libraryVersionHash, 4) == 0;
+
+ if (nixUnit && !nix__isNixApplication()) {
+ *errorString = QStringLiteral("QML compile hash is for a nix store application.");
+ return false;
+ }
+
+ const char *targetHash = qml_compile_hash;
+ size_t targetHashLength = QML_COMPILE_HASH_LENGTH;
+
+ if (nixUnit) {
+ const auto &applicationHash = nix__applicationHash();
+ targetHash = applicationHash.constData();
+ targetHashLength = applicationHash.length();
+ }
+
+ if (qstrncmp(targetHash, this->libraryVersionHash, targetHashLength) != 0) {
*errorString = QStringLiteral("QML compile hashes don't match. Found %1 expected %2")
.arg(QString::fromLatin1(
- QByteArray(libraryVersionHash, QML_COMPILE_HASH_LENGTH)
+ QByteArray(this->libraryVersionHash, targetHashLength)
.toPercentEncoding()),
QString::fromLatin1(
- QByteArray(qml_compile_hash, QML_COMPILE_HASH_LENGTH)
+ QByteArray(targetHash, targetHashLength)
.toPercentEncoding()));
return false;
}
@@ -213,6 +260,29 @@ bool CompilationUnit::saveToDisk(const QUrl &unitUrl, QString *errorString)
return false;
}
+#if defined(QML_COMPILE_HASH) && defined(QML_COMPILE_HASH_LENGTH) && QML_COMPILE_HASH_LENGTH > 0
+ if (nix__isNixApplication() && unitUrl.scheme() == QStringLiteral("qrc")) {
+ // If the application is running from the nix store, we can safely save
+ // bytecode for its embedded QML files as long as we hash the
+ // application path into the version. This will invalidate the caches
+ // when the store path changes.
+ const auto &applicationHash = nix__applicationHash();
+
+ memcpy(const_cast<char *>(unitData()->libraryVersionHash),
+ applicationHash.constData(), applicationHash.length());
+ } else if (unitUrl.path().startsWith(QStringLiteral("@nixStore@"))) {
+ // We don't store bytecode for bare QML files in the nix store as the
+ // paths will change every time the application updates, filling caches
+ // endlessly with junk.
+ *errorString = QStringLiteral("Refusing to save bytecode for bare @nixStore@ path.");
+ return false;
+ } else {
+ // If the QML file is loaded from a normal file path it doesn't matter
+ // if the application itself is running from a nix path, so we fall back
+ // to the default Qt behavior.
+ }
+#endif
+
return SaveableUnitPointer(unitData()).saveToDisk<char>(
[&unitUrl, errorString](const char *data, quint32 size) {
const QString cachePath = localCacheFilePath(unitUrl);

View File

@@ -0,0 +1,10 @@
--- a/src/qml/qml/qqmlimport.cpp
+++ b/src/qml/qml/qqmlimport.cpp
@@ -1520,6 +1520,7 @@ QQmlImportDatabase::QQmlImportDatabase(QQmlEngine *e)
// env import paths
addEnvImportPath("QML_IMPORT_PATH");
addEnvImportPath("QML2_IMPORT_PATH");
+ addEnvImportPath("NIXPKGS_QT6_QML_IMPORT_PATH");
addImportPath(QStringLiteral("qrc:/qt/qml"));
addImportPath(QStringLiteral("qrc:/qt-project.org/imports"));

View File

@@ -0,0 +1,22 @@
{
qtModule,
qtdeclarative,
qtbase,
qttools,
}:
qtModule {
pname = "qtdoc";
# avoid fix-qt-builtin-paths hook substitute QT_INSTALL_DOCS to qtdoc's path
postPatch = ''
for file in $(grep -rl '$QT_INSTALL_DOCS'); do
substituteInPlace $file \
--replace '$QT_INSTALL_DOCS' "${qtbase}/share/doc"
done
'';
nativeBuildInputs = [ (qttools.override { withClang = true; }) ];
propagatedBuildInputs = [ qtdeclarative ];
ninjaFlags = [ "docs" ];
installTargets = [ "install_docs" ];
}

View File

@@ -0,0 +1,17 @@
{
qtModule,
qtbase,
qtdeclarative,
qtquick3d,
qtquicktimeline,
}:
qtModule {
pname = "qtgraphs";
propagatedBuildInputs = [
qtbase
qtdeclarative
qtquick3d
qtquicktimeline
];
}

View File

@@ -0,0 +1,20 @@
{
qtModule,
qtbase,
qtdeclarative,
protobuf,
grpc,
}:
qtModule {
pname = "qtgrpc";
propagatedBuildInputs = [
qtbase
qtdeclarative
];
buildInputs = [
protobuf
grpc
];
}

View File

@@ -0,0 +1,13 @@
{
qtModule,
qtbase,
qtwebsockets,
}:
qtModule {
pname = "qthttpserver";
propagatedBuildInputs = [
qtbase
qtwebsockets
];
}

View File

@@ -0,0 +1,19 @@
{
qtModule,
qtbase,
libwebp,
jasper,
libmng,
libtiff,
}:
qtModule {
pname = "qtimageformats";
propagatedBuildInputs = [ qtbase ];
buildInputs = [
libwebp
jasper
libmng
libtiff
];
}

View File

@@ -0,0 +1,12 @@
{
qtModule,
qtbase,
}:
qtModule {
pname = "qtlanguageserver";
propagatedBuildInputs = [ qtbase ];
# Doesn't have version set
dontCheckQtModuleVersion = true;
}

View File

@@ -0,0 +1,15 @@
{
qtModule,
qtbase,
qtdeclarative,
qtpositioning,
}:
qtModule {
pname = "qtlocation";
propagatedBuildInputs = [
qtbase
qtdeclarative
qtpositioning
];
}

View File

@@ -0,0 +1,13 @@
{
qtModule,
qtbase,
qtdeclarative,
}:
qtModule {
pname = "qtlottie";
propagatedBuildInputs = [
qtbase
qtdeclarative
];
}

View File

@@ -0,0 +1,19 @@
{
qtModule,
fetchFromGitHub,
qtbase,
}:
qtModule rec {
pname = "qtmqtt";
version = "6.9.2";
src = fetchFromGitHub {
owner = "qt";
repo = "qtmqtt";
tag = "v${version}";
hash = "sha256-/qz93JmMkJW3+lzT+QKvb/VL+xmbg5H8kKaXK+XN2nE=";
};
propagatedBuildInputs = [ qtbase ];
}

View File

@@ -0,0 +1,77 @@
{
qtModule,
lib,
stdenv,
qtbase,
qtdeclarative,
qtquick3d,
qtshadertools,
qtsvg,
pkg-config,
alsa-lib,
gstreamer,
gst-plugins-bad,
gst-plugins-base,
gst-plugins-good,
gst-libav,
gst-vaapi,
ffmpeg,
libva,
libpulseaudio,
pipewire,
wayland,
libXrandr,
elfutils,
libunwind,
orc,
pkgsBuildBuild,
}:
qtModule {
pname = "qtmultimedia";
nativeBuildInputs = [ pkg-config ];
buildInputs = [
ffmpeg
]
++ lib.optionals (!stdenv.hostPlatform.isMinGW) [
libunwind
orc
]
++ lib.optionals stdenv.hostPlatform.isLinux [
libpulseaudio
pipewire
alsa-lib
wayland
libXrandr
libva
]
++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform elfutils) [ elfutils ];
propagatedBuildInputs = [
qtbase
qtdeclarative
qtsvg
qtshadertools
]
++ lib.optionals (!stdenv.hostPlatform.isMinGW) [ qtquick3d ]
++ lib.optionals stdenv.hostPlatform.isLinux [
gstreamer
gst-plugins-bad
gst-plugins-base
gst-plugins-good
gst-libav
gst-vaapi
];
patches = lib.optionals stdenv.hostPlatform.isMinGW [
./windows-no-uppercase-libs.patch
./windows-resolve-function-name.patch
];
cmakeFlags = [
"-DENABLE_DYNAMIC_RESOLVE_VAAPI_SYMBOLS=0"
"-DQt6ShaderToolsTools_DIR=${pkgsBuildBuild.qt6.qtshadertools}/lib/cmake/Qt6ShaderToolsTools"
];
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin "-include AudioToolbox/AudioToolbox.h";
NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin "-framework AudioToolbox";
}

View File

@@ -0,0 +1,11 @@
--- a/src/plugins/multimedia/ffmpeg/qffmpegscreencapture_dxgi.cpp
+++ b/src/plugins/multimedia/ffmpeg/qffmpegscreencapture_dxgi.cpp
@@ -14,7 +14,7 @@
#include <qwaitcondition.h>
#include <qmutex.h>
-#include "D3d11.h"
+#include "d3d11.h"
#include "dxgi1_2.h"
#include <system_error>

View File

@@ -0,0 +1,28 @@
--- a/src/plugins/multimedia/ffmpeg/qwincapturablewindows.cpp
+++ b/src/plugins/multimedia/ffmpeg/qwincapturablewindows.cpp
@@ -42,11 +42,7 @@ static QString windowTitle(HWND hwnd) {
return QString::fromStdWString(buffer);
}
-QList<QCapturableWindow> QWinCapturableWindows::windows() const
-{
- QList<QCapturableWindow> result;
-
- auto windowHandler = [](HWND hwnd, LPARAM lParam) {
+static int __stdcall windowHandler(HWND hwnd, LPARAM lParam) {
if (!canCaptureWindow(hwnd))
return TRUE; // Ignore window and continue enumerating
@@ -58,7 +54,11 @@ QList<QCapturableWindow> QWinCapturableWindows::windows() const
windows.push_back(windowData.release()->create());
return TRUE;
- };
+}
+
+QList<QCapturableWindow> QWinCapturableWindows::windows() const
+{
+ QList<QCapturableWindow> result;
::EnumWindows(windowHandler, reinterpret_cast<LPARAM>(&result));

View File

@@ -0,0 +1,6 @@
{ qtModule, qtbase }:
qtModule {
pname = "qtnetworkauth";
propagatedBuildInputs = [ qtbase ];
}

View File

@@ -0,0 +1,19 @@
{
qtModule,
qtbase,
qtdeclarative,
qtserialport,
pkg-config,
openssl,
}:
qtModule {
pname = "qtpositioning";
propagatedBuildInputs = [
qtbase
qtdeclarative
qtserialport
];
nativeBuildInputs = [ pkg-config ];
buildInputs = [ openssl ];
}

View File

@@ -0,0 +1,15 @@
{
qtModule,
qtbase,
qtdeclarative,
openssl,
}:
qtModule {
pname = "qtquick3d";
propagatedBuildInputs = [
qtbase
qtdeclarative
];
buildInputs = [ openssl ];
}

View File

@@ -0,0 +1,16 @@
{
qtModule,
lib,
stdenv,
qtbase,
qtquick3d,
}:
qtModule {
pname = "qtquick3dphysics";
propagatedBuildInputs = [
qtbase
qtquick3d
];
meta.mainProgram = "cooker";
}

View File

@@ -0,0 +1,14 @@
{
qtModule,
qtbase,
qtquick3d,
}:
qtModule {
pname = "qtquickeffectmaker";
propagatedBuildInputs = [
qtbase
qtquick3d
];
meta.mainProgram = "qqem";
}

View File

@@ -0,0 +1,13 @@
{
qtModule,
qtbase,
qtdeclarative,
}:
qtModule {
pname = "qtquicktimeline";
propagatedBuildInputs = [
qtbase
qtdeclarative
];
}

View File

@@ -0,0 +1,13 @@
{
qtModule,
qtbase,
qtdeclarative,
}:
qtModule {
pname = "qtremoteobjects";
propagatedBuildInputs = [
qtbase
qtdeclarative
];
}

View File

@@ -0,0 +1,13 @@
{
qtModule,
qtbase,
qtdeclarative,
}:
qtModule {
pname = "qtscxml";
propagatedBuildInputs = [
qtbase
qtdeclarative
];
}

View File

@@ -0,0 +1,15 @@
{
qtModule,
qtbase,
qtdeclarative,
qtsvg,
}:
qtModule {
pname = "qtsensors";
propagatedBuildInputs = [
qtbase
qtdeclarative
qtsvg
];
}

View File

@@ -0,0 +1,14 @@
{
qtModule,
qtbase,
qtserialport,
}:
qtModule {
pname = "qtserialbus";
propagatedBuildInputs = [
qtbase
qtserialport
];
meta.mainProgram = "canbusutil";
}

View File

@@ -0,0 +1,14 @@
{
qtModule,
stdenv,
lib,
qtbase,
udev,
pkg-config,
}:
qtModule {
pname = "qtserialport";
nativeBuildInputs = [ pkg-config ];
propagatedBuildInputs = [ qtbase ] ++ lib.optionals stdenv.hostPlatform.isLinux [ udev ];
}

View File

@@ -0,0 +1,16 @@
{
qtModule,
qtbase,
stdenv,
lib,
pkgsBuildBuild,
}:
qtModule {
pname = "qtshadertools";
propagatedBuildInputs = [ qtbase ];
cmakeFlags = lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
"-DQt6ShaderToolsTools_DIR=${pkgsBuildBuild.qt6.qtshadertools}/lib/cmake/Qt6ShaderToolsTools"
];
meta.mainProgram = "qsb";
}

View File

@@ -0,0 +1,25 @@
{
qtModule,
lib,
stdenv,
qtbase,
qtmultimedia,
pkg-config,
flite,
alsa-lib,
speechd-minimal,
}:
qtModule {
pname = "qtspeech";
nativeBuildInputs = [ pkg-config ];
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
flite
alsa-lib
speechd-minimal
];
propagatedBuildInputs = [
qtbase
qtmultimedia
];
}

View File

@@ -0,0 +1,27 @@
{
qtModule,
qtbase,
libwebp,
jasper,
libmng,
zlib,
pkg-config,
lib,
stdenv,
}:
qtModule {
pname = "qtsvg";
propagatedBuildInputs = [ qtbase ];
buildInputs = [
libwebp
]
++ lib.optionals (stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
jasper
]
++ [
libmng
zlib
];
nativeBuildInputs = [ pkg-config ];
}

View File

@@ -0,0 +1,58 @@
{
pkgsBuildBuild,
qtModule,
stdenv,
lib,
qtbase,
qtdeclarative,
cups,
llvmPackages_20,
# clang-based c++ parser for qdoc and lupdate
withClang ? false,
}:
qtModule {
pname = "qttools";
patches = [
./paths.patch
];
postPatch = ''
substituteInPlace \
src/qdoc/catch/CMakeLists.txt \
src/qdoc/catch_generators/CMakeLists.txt \
src/qdoc/catch_conversions/CMakeLists.txt \
--replace ''\'''${CMAKE_INSTALL_INCLUDEDIR}' "$out/include"
'';
env.NIX_CFLAGS_COMPILE = toString [
"-DNIX_OUTPUT_OUT=\"${placeholder "out"}\""
];
# FIXME: update to LLVM 21 with Qt 6.10
buildInputs = lib.optionals withClang [
llvmPackages_20.libclang
llvmPackages_20.llvm
];
propagatedBuildInputs = [
qtbase
qtdeclarative
]
++ lib.optionals stdenv.hostPlatform.isDarwin [ cups ];
cmakeFlags =
lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
"-DQt6LinguistTools_DIR=${pkgsBuildBuild.qt6.qttools}/lib/cmake/Qt6LinguistTools"
"-DQt6ToolsTools_DIR=${pkgsBuildBuild.qt6.qttools}/lib/cmake/Qt6ToolsTools"
]
++ lib.optionals withClang [
"-DFEATURE_clang=ON"
];
postInstall = ''
mkdir -p "$dev"
ln -s "$out/bin" "$dev/bin"
'';
}

View File

@@ -0,0 +1,25 @@
--- a/src/linguist/shared/runqttool.cpp
+++ b/src/linguist/shared/runqttool.cpp
@@ -20,9 +20,21 @@ class FMT {
Q_DECLARE_TR_FUNCTIONS(Linguist)
};
+static QString qtBasePath(QLibraryInfo::LibraryPath location)
+{
+ switch (location) {
+ case QLibraryInfo::BinariesPath:
+ return QLatin1String(NIX_OUTPUT_OUT) + QLatin1String("/bin");
+ case QLibraryInfo::LibraryExecutablesPath:
+ return QLatin1String(NIX_OUTPUT_OUT) + QLatin1String("/libexec");
+ default:
+ return QLibraryInfo::path(location);
+ }
+}
+
static QString qtToolFilePath(const QString &toolName, QLibraryInfo::LibraryPath location)
{
- QString filePath = QLibraryInfo::path(location) + QLatin1Char('/') + toolName;
+ QString filePath = qtBasePath(location) + QLatin1Char('/') + toolName;
#ifdef Q_OS_WIN
filePath.append(QLatin1String(".exe"));
#endif

View File

@@ -0,0 +1,10 @@
{
qtModule,
qttools,
}:
qtModule {
pname = "qttranslations";
nativeBuildInputs = [ qttools ];
outputs = [ "out" ];
}

View File

@@ -0,0 +1,19 @@
{
qtModule,
qtbase,
qtdeclarative,
qtsvg,
hunspell,
pkg-config,
}:
qtModule {
pname = "qtvirtualkeyboard";
propagatedBuildInputs = [
qtbase
qtdeclarative
qtsvg
hunspell
];
nativeBuildInputs = [ pkg-config ];
}

View File

@@ -0,0 +1,41 @@
{
pkgsBuildBuild,
stdenv,
lib,
qtModule,
qtbase,
qtdeclarative,
wayland,
wayland-scanner,
pkg-config,
libdrm,
}:
qtModule {
pname = "qtwayland";
# wayland-scanner needs to be propagated as both build
# (for the wayland-scanner binary) and host (for the
# actual wayland.xml protocol definition)
propagatedBuildInputs = [
qtbase
qtdeclarative
wayland
wayland-scanner
];
propagatedNativeBuildInputs = [
wayland
wayland-scanner
];
buildInputs = [ libdrm ];
nativeBuildInputs = [ pkg-config ];
cmakeFlags = lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
"-DQt6WaylandScannerTools_DIR=${pkgsBuildBuild.qt6.qtwayland}/lib/cmake/Qt6WaylandScannerTools"
];
meta = {
platforms = lib.platforms.unix;
badPlatforms = lib.platforms.darwin;
};
}

View File

@@ -0,0 +1,17 @@
{
qtModule,
qtbase,
qtdeclarative,
qtwebsockets,
openssl,
}:
qtModule {
pname = "qtwebchannel";
propagatedBuildInputs = [
qtbase
qtdeclarative
qtwebsockets
];
buildInputs = [ openssl ];
}

View File

@@ -0,0 +1,301 @@
{
qtModule,
qtdeclarative,
qtwebchannel,
qtpositioning,
qtwebsockets,
buildPackages,
bison,
coreutils,
flex,
gperf,
ninja,
pkg-config,
python3,
which,
nodejs,
xorg,
libXcursor,
libXScrnSaver,
libXrandr,
libXtst,
libxshmfence,
libXi,
cups,
fontconfig,
freetype,
harfbuzz,
icu,
dbus,
libdrm,
zlib,
minizip,
libjpeg,
libpng,
libtiff,
libwebp,
libopus,
jsoncpp,
protobuf,
libvpx,
srtp,
snappy,
nss,
libevent,
openssl,
alsa-lib,
pulseaudio,
libcap,
pciutils,
systemd,
pipewire,
gn,
ffmpeg,
lib,
stdenv,
glib,
libxml2,
libxslt,
lcms2,
libkrb5,
libgbm,
enableProprietaryCodecs ? true,
# darwin
bootstrap_cmds,
cctools,
xcbuild,
fetchpatch,
}:
qtModule {
pname = "qtwebengine";
nativeBuildInputs = [
bison
coreutils
flex
gperf
ninja
pkg-config
(python3.withPackages (ps: with ps; [ html5lib ]))
which
gn
nodejs
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
bootstrap_cmds
cctools
xcbuild
];
doCheck = true;
outputs = [
"out"
"dev"
];
dontUseGnConfigure = true;
# ninja builds some components with -Wno-format,
# which cannot be set at the same time as -Wformat-security
hardeningDisable = [ "format" ];
patches = [
# Don't assume /usr/share/X11, and also respect the XKB_CONFIG_ROOT
# environment variable, since NixOS relies on it working.
# See https://github.com/NixOS/nixpkgs/issues/226484 for more context.
./xkb-includes.patch
./link-pulseaudio.patch
# Override locales install path so they go to QtWebEngine's $out
./locales-path.patch
# Reproducibility QTBUG-136068
./gn-object-sorted.patch
# Revert "Create EGLImage with eglCreateDRMImageMESA() for exporting dma_buf"
# Mesa 25.2 dropped eglCreateDRMImageMESA, so this no longer works.
# There are better ways to do this, but this is the easy fix for now.
(fetchpatch {
url = "https://invent.kde.org/qt/qt/qtwebengine/-/commit/ddcd30454aa6338d898c9d20c8feb48f36632e16.diff";
revert = true;
hash = "sha256-ht7C3GIEaPtmMGLzQKOtMqE9sLKdqqYCgi/W6b430YU=";
})
];
postPatch = ''
# Patch Chromium build tools
(
cd src/3rdparty/chromium;
# Manually fix unsupported shebangs
substituteInPlace third_party/harfbuzz-ng/src/src/update-unicode-tables.make \
--replace "/usr/bin/env -S make -f" "/usr/bin/make -f" || true
substituteInPlace third_party/webgpu-cts/src/tools/run_deno \
--replace "/usr/bin/env -S deno" "/usr/bin/deno" || true
patchShebangs .
)
substituteInPlace cmake/Functions.cmake \
--replace "/bin/bash" "${buildPackages.bash}/bin/bash"
# Patch library paths in sources
substituteInPlace src/core/web_engine_library_info.cpp \
--replace "QLibraryInfo::path(QLibraryInfo::DataPath)" "\"$out\"" \
--replace "QLibraryInfo::path(QLibraryInfo::TranslationsPath)" "\"$out/translations\"" \
--replace "QLibraryInfo::path(QLibraryInfo::LibraryExecutablesPath)" "\"$out/libexec\""
substituteInPlace configure.cmake src/gn/CMakeLists.txt \
--replace "AppleClang" "Clang"
# Disable metal shader compilation, Xcode only
substituteInPlace src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/metal/metal_backend.gni \
--replace-fail 'angle_has_build && !is_ios && target_os == host_os' "false"
''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
sed -i -e '/lib_loader.*Load/s!"\(libudev\.so\)!"${lib.getLib systemd}/lib/\1!' \
src/3rdparty/chromium/device/udev_linux/udev?_loader.cc
sed -i -e '/libpci_loader.*Load/s!"\(libpci\.so\)!"${pciutils}/lib/\1!' \
src/3rdparty/chromium/gpu/config/gpu_info_collector_linux.cc
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace cmake/QtToolchainHelpers.cmake \
--replace-fail "/usr/bin/xcrun" "${xcbuild}/bin/xcrun"
'';
cmakeFlags = [
"-DQT_FEATURE_qtpdf_build=ON"
"-DQT_FEATURE_qtpdf_widgets_build=ON"
"-DQT_FEATURE_qtpdf_quick_build=ON"
"-DQT_FEATURE_pdf_v8=ON"
"-DQT_FEATURE_pdf_xfa=ON"
"-DQT_FEATURE_pdf_xfa_bmp=ON"
"-DQT_FEATURE_pdf_xfa_gif=ON"
"-DQT_FEATURE_pdf_xfa_png=ON"
"-DQT_FEATURE_pdf_xfa_tiff=ON"
"-DQT_FEATURE_webengine_system_libevent=ON"
"-DQT_FEATURE_webengine_system_ffmpeg=ON"
# android only. https://bugreports.qt.io/browse/QTBUG-100293
# "-DQT_FEATURE_webengine_native_spellchecker=ON"
"-DQT_FEATURE_webengine_sanitizer=ON"
"-DQT_FEATURE_webengine_kerberos=ON"
]
++ lib.optionals stdenv.hostPlatform.isLinux [
"-DQT_FEATURE_webengine_system_libxml=ON"
"-DQT_FEATURE_webengine_webrtc_pipewire=ON"
# Appears not to work on some platforms
# https://github.com/Homebrew/homebrew-core/issues/104008
"-DQT_FEATURE_webengine_system_icu=ON"
]
++ lib.optionals enableProprietaryCodecs [
"-DQT_FEATURE_webengine_proprietary_codecs=ON"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
"-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0" # Per Qt 6s deployment target (why doesnt the hook work?)
];
propagatedBuildInputs = [
qtdeclarative
qtwebchannel
qtwebsockets
qtpositioning
# Image formats
libjpeg
libpng
libtiff
libwebp
# Video formats
srtp
libvpx
# Audio formats
libopus
# Text rendering
harfbuzz
openssl
glib
libxslt
lcms2
libevent
ffmpeg
]
++ lib.optionals stdenv.hostPlatform.isLinux [
dbus
zlib
minizip
snappy
nss
protobuf
jsoncpp
icu
libxml2
# Audio formats
alsa-lib
pulseaudio
# Text rendering
fontconfig
freetype
libcap
pciutils
# X11 libs
xorg.xrandr
libXScrnSaver
libXcursor
libXrandr
xorg.libpciaccess
libXtst
xorg.libXcomposite
xorg.libXdamage
libdrm
xorg.libxkbfile
libxshmfence
libXi
xorg.libXext
# Pipewire
pipewire
libkrb5
libgbm
];
buildInputs = [
cups
];
requiredSystemFeatures = [ "big-parallel" ];
preConfigure = ''
export NINJAFLAGS="-j$NIX_BUILD_CORES"
'';
# Debug info is too big to link with LTO.
separateDebugInfo = false;
meta = {
description = "Web engine based on the Chromium web browser";
platforms = [
"x86_64-darwin"
"aarch64-darwin"
"aarch64-linux"
"armv7a-linux"
"armv7l-linux"
"x86_64-linux"
];
# This build takes a long time; particularly on slow architectures
# 1 hour on 32x3.6GHz -> maybe 12 hours on 4x2.4GHz
timeout = 24 * 3600;
};
}

View File

@@ -0,0 +1,32 @@
diff --git a/gn/src/gn/rsp_target_writer.cc b/gn/src/gn/rsp_target_writer.cc
index 6c1c687e99d..097b84b317e 100644
--- a/src/3rdparty/gn/src/gn/rsp_target_writer.cc
+++ b/src/3rdparty/gn/src/gn/rsp_target_writer.cc
@@ -117,8 +117,7 @@ void RspTargetWriter::Run() {
PathOutput path_output(settings->build_settings()->build_dir(),
settings->build_settings()->root_path_utf8(),
ESCAPE_NONE);
- std::vector<SourceFile> object_files;
- object_files.reserve(target_->sources().size());
+ std::set<SourceFile> object_files;
for (const auto& source : target_->sources()) {
const char* tool_type = nullptr;
@@ -128,7 +127,7 @@ void RspTargetWriter::Run() {
other_files.push_back(source);
continue; // No output for this source.
}
- object_files.push_back(
+ object_files.insert(
tool_outputs[0].AsSourceFile(settings->build_settings()));
}
if (target_->config_values().has_precompiled_headers()) {
@@ -137,7 +136,7 @@ void RspTargetWriter::Run() {
if (tool_cxx && tool_cxx->precompiled_header_type() == CTool::PCH_MSVC) {
GetPCHOutputFiles(target_, CTool::kCToolCxx, &tool_outputs);
if (!tool_outputs.empty())
- object_files.push_back(
+ object_files.insert(
tool_outputs[0].AsSourceFile(settings->build_settings()));
}
}

View File

@@ -0,0 +1,12 @@
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index cc992b4d2..0a01ff03a 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -368,6 +368,7 @@ foreach(arch ${archs})
devtools_skip_typecheck=false
content_enable_legacy_ipc=true
headless_use_policy=false
+ link_pulseaudio=true
)
extend_gn_list(gnArgArg
ARGS use_v8_context_snapshot v8_use_external_startup_data

View File

@@ -0,0 +1,27 @@
diff --git a/src/core/api/CMakeLists.txt b/src/core/api/CMakeLists.txt
index dbe881ecf..9ba6ceffe 100644
--- a/src/core/api/CMakeLists.txt
+++ b/src/core/api/CMakeLists.txt
@@ -214,7 +214,7 @@ if(QT_FEATURE_framework)
)
else()
- set(locale_install_path "${INSTALL_TRANSLATIONSDIR}/qtwebengine_locales")
+ set(locale_install_path "${INSTALL_DATADIR}/qtwebengine_locales")
install(FILES ${localeFiles}
DESTINATION ${locale_install_path}
CONFIGURATIONS ${config}
diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp
index ef88a59b8..d63de34c8 100644
--- a/src/core/web_engine_library_info.cpp
+++ b/src/core/web_engine_library_info.cpp
@@ -198,7 +198,8 @@ QString localesPath()
candidatePaths << getResourcesPath(frameworkBundle()) % QDir::separator()
% "qtwebengine_locales"_L1;
#endif
- candidatePaths << QLibraryInfo::path(QLibraryInfo::TranslationsPath) % QDir::separator()
+ // Nixpkgs: match the changes made in CMakeLists.txt
+ candidatePaths << QLibraryInfo::path(QLibraryInfo::DataPath) % QDir::separator()
% "qtwebengine_locales"_L1;
candidatePaths << fallbackDir();
} else {

View File

@@ -0,0 +1,12 @@
--- a/src/3rdparty/chromium/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc 2023-04-19 21:58:29.127258300 +0900
+++ b/src/3rdparty/chromium/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc 2023-04-19 22:01:35.860196284 +0900
@@ -637,8 +637,7 @@
.variant = layout_variant.c_str(),
.options = ""};
std::unique_ptr<xkb_context, XkbContextDeleter> context;
- context.reset(xkb_context_new(XKB_CONTEXT_NO_DEFAULT_INCLUDES));
- xkb_context_include_path_append(context.get(), "/usr/share/X11/xkb");
+ context.reset(xkb_context_new(XKB_CONTEXT_NO_FLAGS));
std::unique_ptr<xkb_keymap, XkbKeymapDeleter> keymap;
keymap.reset(xkb_keymap_new_from_names(context.get(), &names,
XKB_KEYMAP_COMPILE_NO_FLAGS));

View File

@@ -0,0 +1,15 @@
{
qtModule,
qtbase,
qtdeclarative,
openssl,
}:
qtModule {
pname = "qtwebsockets";
propagatedBuildInputs = [
qtbase
qtdeclarative
];
buildInputs = [ openssl ];
}

View File

@@ -0,0 +1,15 @@
{
lib,
stdenv,
qtModule,
qtdeclarative,
qtwebengine,
}:
qtModule {
pname = "qtwebview";
propagatedBuildInputs = [
qtdeclarative
]
++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ qtwebengine ];
}