mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-03-08 01:24:09 +01:00
qmllint hook 3: the hookening (#318190)
This commit is contained in:
commit
4c501ed546
15 changed files with 125 additions and 2 deletions
|
|
@ -16,5 +16,8 @@ mkKdeDerivation {
|
|||
qttools
|
||||
];
|
||||
extraPropagatedBuildInputs = [ kcmutils ];
|
||||
|
||||
dontQmlLint = true; # weird namespace setup
|
||||
|
||||
meta.mainProgram = "knewstuff-dialog6";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
{
|
||||
mkKdeDerivation,
|
||||
qtdeclarative,
|
||||
kirigami,
|
||||
}:
|
||||
mkKdeDerivation {
|
||||
pname = "kquickcharts";
|
||||
|
||||
extraBuildInputs = [ qtdeclarative ];
|
||||
extraPropagatedBuildInputs = [ kirigami ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
lib,
|
||||
mkKdeDerivation,
|
||||
libkcompactdisc,
|
||||
cdparanoia,
|
||||
flac,
|
||||
libogg,
|
||||
|
|
@ -20,6 +21,8 @@ mkKdeDerivation {
|
|||
];
|
||||
|
||||
extraBuildInputs = [
|
||||
libkcompactdisc
|
||||
|
||||
cdparanoia
|
||||
flac
|
||||
libogg
|
||||
|
|
|
|||
|
|
@ -12,4 +12,7 @@ mkKdeDerivation {
|
|||
qtsvg
|
||||
libplasma
|
||||
];
|
||||
|
||||
# FIXME: not sure why this is failing
|
||||
dontQmlLint = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
qt5compat,
|
||||
qtdeclarative,
|
||||
qgpgme,
|
||||
kirigami,
|
||||
qtwebengine,
|
||||
}:
|
||||
mkKdeDerivation {
|
||||
pname = "mimetreeparser";
|
||||
|
|
@ -12,4 +14,9 @@ mkKdeDerivation {
|
|||
qtdeclarative
|
||||
qgpgme
|
||||
];
|
||||
|
||||
extraPropagatedBuildInputs = [
|
||||
kirigami
|
||||
qtwebengine
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
57
pkgs/kde/lib/qmllint-hook.sh
Normal file
57
pkgs/kde/lib/qmllint-hook.sh
Normal file
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -41,4 +41,7 @@ mkKdeDerivation {
|
|||
|
||||
libxcvt
|
||||
];
|
||||
|
||||
# plugin QML relies on non-global imports
|
||||
dontQmlLint = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
qtwebchannel,
|
||||
qtwebengine,
|
||||
qttools,
|
||||
kitemmodels,
|
||||
kquickcharts,
|
||||
libpcap,
|
||||
libnl,
|
||||
lm_sensors,
|
||||
|
|
@ -22,4 +24,9 @@ mkKdeDerivation {
|
|||
libnl
|
||||
lm_sensors
|
||||
];
|
||||
|
||||
extraPropagatedBuildInputs = [
|
||||
kitemmodels
|
||||
kquickcharts
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,11 @@
|
|||
{ mkKdeDerivation }:
|
||||
{
|
||||
mkKdeDerivation,
|
||||
kquickcharts,
|
||||
}:
|
||||
mkKdeDerivation {
|
||||
pname = "plasma-systemmonitor";
|
||||
|
||||
extraPropagatedBuildInputs = [ kquickcharts ];
|
||||
|
||||
meta.mainProgram = "plasma-systemmonitor";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue