diff --git a/pkgs/kde/frameworks/knewstuff/default.nix b/pkgs/kde/frameworks/knewstuff/default.nix index 8bbc171f2408..8a364849412a 100644 --- a/pkgs/kde/frameworks/knewstuff/default.nix +++ b/pkgs/kde/frameworks/knewstuff/default.nix @@ -16,5 +16,8 @@ mkKdeDerivation { qttools ]; extraPropagatedBuildInputs = [ kcmutils ]; + + dontQmlLint = true; # weird namespace setup + meta.mainProgram = "knewstuff-dialog6"; } diff --git a/pkgs/kde/frameworks/kquickcharts/default.nix b/pkgs/kde/frameworks/kquickcharts/default.nix index 736f06510336..c9ec4afbb050 100644 --- a/pkgs/kde/frameworks/kquickcharts/default.nix +++ b/pkgs/kde/frameworks/kquickcharts/default.nix @@ -1,9 +1,11 @@ { mkKdeDerivation, qtdeclarative, + kirigami, }: mkKdeDerivation { pname = "kquickcharts"; extraBuildInputs = [ qtdeclarative ]; + extraPropagatedBuildInputs = [ kirigami ]; } diff --git a/pkgs/kde/gear/audiocd-kio/default.nix b/pkgs/kde/gear/audiocd-kio/default.nix index f331cac51aa1..827038e05ec4 100644 --- a/pkgs/kde/gear/audiocd-kio/default.nix +++ b/pkgs/kde/gear/audiocd-kio/default.nix @@ -1,6 +1,7 @@ { lib, mkKdeDerivation, + libkcompactdisc, cdparanoia, flac, libogg, @@ -20,6 +21,8 @@ mkKdeDerivation { ]; extraBuildInputs = [ + libkcompactdisc + cdparanoia flac libogg diff --git a/pkgs/kde/gear/merkuro/default.nix b/pkgs/kde/gear/merkuro/default.nix index a6a2c70c5732..08b44e7a8d7f 100644 --- a/pkgs/kde/gear/merkuro/default.nix +++ b/pkgs/kde/gear/merkuro/default.nix @@ -12,4 +12,7 @@ mkKdeDerivation { qtsvg libplasma ]; + + # FIXME: not sure why this is failing + dontQmlLint = true; } diff --git a/pkgs/kde/gear/mimetreeparser/default.nix b/pkgs/kde/gear/mimetreeparser/default.nix index 67c271ad2612..d6f3f16ccc54 100644 --- a/pkgs/kde/gear/mimetreeparser/default.nix +++ b/pkgs/kde/gear/mimetreeparser/default.nix @@ -3,6 +3,8 @@ qt5compat, qtdeclarative, qgpgme, + kirigami, + qtwebengine, }: mkKdeDerivation { pname = "mimetreeparser"; @@ -12,4 +14,9 @@ mkKdeDerivation { qtdeclarative qgpgme ]; + + extraPropagatedBuildInputs = [ + kirigami + qtwebengine + ]; } diff --git a/pkgs/kde/lib/mk-kde-derivation.nix b/pkgs/kde/lib/mk-kde-derivation.nix index 54f7f922d94e..e013644e6908 100644 --- a/pkgs/kde/lib/mk-kde-derivation.nix +++ b/pkgs/kde/lib/mk-kde-derivation.nix @@ -8,6 +8,7 @@ self: qt6, python3, python3Packages, + jq, }: let dependencies = (lib.importJSON ../generated/dependencies.json).dependencies; @@ -77,6 +78,14 @@ let }; moveOutputsHook = makeSetupHook { name = "kf6-move-outputs-hook"; } ./move-outputs-hook.sh; + + qmllintHook = makeSetupHook { + name = "qmllint-validate-hook"; + substitutions = { + qmllint = "${qt6.qtdeclarative}/bin/qmllint"; + jq = lib.getExe jq; + }; + } ./qmllint-hook.sh; in { pname, @@ -131,6 +140,7 @@ let ninja qt6.wrapQtAppsHook moveOutputsHook + qmllintHook ] ++ lib.optionals hasPythonBindings [ python3Packages.shiboken6 @@ -155,6 +165,8 @@ let cmakeFlags = [ "-DQT_MAJOR_VERSION=6" ] ++ extraCmakeFlags; + doInstallCheck = true; + separateDebugInfo = true; env.LANG = "C.UTF-8"; diff --git a/pkgs/kde/lib/qmllint-hook.sh b/pkgs/kde/lib/qmllint-hook.sh new file mode 100644 index 000000000000..e42dff126edc --- /dev/null +++ b/pkgs/kde/lib/qmllint-hook.sh @@ -0,0 +1,57 @@ +# shellcheck shell=bash +if [[ -z "${__nix_qmllintHook-}" ]]; then + __nix_qmllintHook=1 # Don't run this hook more than once. + + qmlHostPathSeen=() + qmlIncludeDirs=() + + qmlUnseenHostPath() { + for pkg in "${qmlHostPathSeen[@]}"; do + if [ "${pkg:?}" == "$1" ]; then + return 1 + fi + done + + qtHostPathSeen+=("$1") + return 0 + } + + qmlHostPathHook() { + qmlUnseenHostPath "$1" || return 0 + + if ! [ -v qtQmlPrefix ]; then + echo "qmlLintHook: qtQmlPrefix is unset. hint: add qt6.qtbase to buildInputs" + fi + + local qmlDir="$1/${qtQmlPrefix:?}" + if [ -d "$qmlDir" ]; then + qmlIncludeDirs+=("-I" "$qmlDir") + fi + } + addEnvHooks "$targetOffset" qmlHostPathHook + + doQmlLint() { + LANG=C.UTF-8 @qmllint@ --bare "${qmlIncludeDirs[@]}" -I "${out}/${qtQmlPrefix}" "$@" + } + + qmlLintCheck() { + echo "Running qmlLintCheck" + + # intentionally scoped to the default QML prefix, as things in $out/share etc + # can be used in random weird contexts and will cause spurious errors + if [ -d "$out/$qtQmlPrefix" ]; then + find "$out/$qtQmlPrefix" -name '*.qml' | while IFS= read -r i; do + if [ -n "$(doQmlLint "$i" --json - | @jq@ '.files[] | .warnings[] | select(.id == "import") | select(.message | startswith("Failed to import"))')" ]; then + echo "qmllint failed for file $i:" + + doQmlLint "$i" + exit 1 + fi + done + fi + } + + if [ -z "${dontQmlLint-}" ]; then + postInstallCheckHooks+=('qmlLintCheck') + fi +fi diff --git a/pkgs/kde/misc/kirigami-addons/default.nix b/pkgs/kde/misc/kirigami-addons/default.nix index 60c13e979a87..ac0709aaedd5 100644 --- a/pkgs/kde/misc/kirigami-addons/default.nix +++ b/pkgs/kde/misc/kirigami-addons/default.nix @@ -3,8 +3,10 @@ mkKdeDerivation, fetchurl, qtdeclarative, + qtmultimedia, qt5compat, qttools, + kitemmodels, }: mkKdeDerivation rec { pname = "kirigami-addons"; @@ -17,7 +19,11 @@ mkKdeDerivation rec { extraNativeBuildInputs = [ qttools ]; extraBuildInputs = [ qtdeclarative ]; - extraPropagatedBuildInputs = [ qt5compat ]; + extraPropagatedBuildInputs = [ + qt5compat + qtmultimedia + kitemmodels + ]; meta.license = with lib.licenses; [ bsd2 diff --git a/pkgs/kde/plasma/kwin-x11/default.nix b/pkgs/kde/plasma/kwin-x11/default.nix index b32ccb04f6d5..3a6b832d4ec1 100644 --- a/pkgs/kde/plasma/kwin-x11/default.nix +++ b/pkgs/kde/plasma/kwin-x11/default.nix @@ -41,4 +41,7 @@ mkKdeDerivation { libxcvt ]; + + # plugin QML relies on non-global imports + dontQmlLint = true; } diff --git a/pkgs/kde/plasma/kwin/default.nix b/pkgs/kde/plasma/kwin/default.nix index 7cee0fc0fcaf..334990f9b08e 100644 --- a/pkgs/kde/plasma/kwin/default.nix +++ b/pkgs/kde/plasma/kwin/default.nix @@ -64,4 +64,7 @@ mkKdeDerivation { # we need to provide this so it knows our xwayland supports new features xwayland ]; + + # plugin QML relies on non-global imports + dontQmlLint = true; } diff --git a/pkgs/kde/plasma/libksysguard/default.nix b/pkgs/kde/plasma/libksysguard/default.nix index e47da4a5fafd..d3de2807802f 100644 --- a/pkgs/kde/plasma/libksysguard/default.nix +++ b/pkgs/kde/plasma/libksysguard/default.nix @@ -3,6 +3,8 @@ qtwebchannel, qtwebengine, qttools, + kitemmodels, + kquickcharts, libpcap, libnl, lm_sensors, @@ -22,4 +24,9 @@ mkKdeDerivation { libnl lm_sensors ]; + + extraPropagatedBuildInputs = [ + kitemmodels + kquickcharts + ]; } diff --git a/pkgs/kde/plasma/plasma-keyboard/default.nix b/pkgs/kde/plasma/plasma-keyboard/default.nix index e26f2999eee6..be510d3ef01d 100644 --- a/pkgs/kde/plasma/plasma-keyboard/default.nix +++ b/pkgs/kde/plasma/plasma-keyboard/default.nix @@ -20,4 +20,7 @@ mkKdeDerivation { # FIXME: fix this upstream? This should probably be XDG_DATA_DIRS "--set QT_VIRTUALKEYBOARD_HUNSPELL_DATA_PATH /run/current-system/sw/share/hunspell/" ]; + + # themes rely on non-global imports + dontQmlLint = true; } diff --git a/pkgs/kde/plasma/plasma-nm/default.nix b/pkgs/kde/plasma/plasma-nm/default.nix index 3662452bad7b..e143752476b3 100644 --- a/pkgs/kde/plasma/plasma-nm/default.nix +++ b/pkgs/kde/plasma/plasma-nm/default.nix @@ -3,6 +3,7 @@ replaceVars, pkg-config, qtwebengine, + kirigami-addons, mobile-broadband-provider-info, openconnect, openvpn, @@ -22,4 +23,6 @@ mkKdeDerivation { mobile-broadband-provider-info openconnect ]; + + extraPropagatedBuildInputs = [ kirigami-addons ]; } diff --git a/pkgs/kde/plasma/plasma-systemmonitor/default.nix b/pkgs/kde/plasma/plasma-systemmonitor/default.nix index 0aceb98496ac..21bdb84910cd 100644 --- a/pkgs/kde/plasma/plasma-systemmonitor/default.nix +++ b/pkgs/kde/plasma/plasma-systemmonitor/default.nix @@ -1,5 +1,11 @@ -{ mkKdeDerivation }: +{ + mkKdeDerivation, + kquickcharts, +}: mkKdeDerivation { pname = "plasma-systemmonitor"; + + extraPropagatedBuildInputs = [ kquickcharts ]; + meta.mainProgram = "plasma-systemmonitor"; } diff --git a/pkgs/kde/plasma/plasma-workspace/default.nix b/pkgs/kde/plasma/plasma-workspace/default.nix index 94b877c242f6..e3a707499c40 100644 --- a/pkgs/kde/plasma/plasma-workspace/default.nix +++ b/pkgs/kde/plasma/plasma-workspace/default.nix @@ -15,6 +15,7 @@ qtlocation, qtpositioning, qtsvg, + qtvirtualkeyboard, qtwayland, libcanberra, libqalculate, @@ -72,6 +73,10 @@ mkKdeDerivation { gpsd ]; + extraPropagatedBuildInputs = [ + qtvirtualkeyboard + ]; + qtWrapperArgs = [ "--inherit-argv0" ]; # Hardcoded as QStrings, which are UTF-16 so Nix can't pick these up automatically