add qmllint check with baseline diffing and Qt/Quickshell import paths

This commit is contained in:
Damocles 2026-04-18 15:44:58 +02:00
parent 91cd18cbcd
commit 3944f99316
2 changed files with 119 additions and 0 deletions

View file

@ -86,6 +86,7 @@
clippy
rustfmt
libnotify
qt6.qtdeclarative
];
};
}
@ -98,6 +99,40 @@
build = self.packages.${pkgs.stdenv.hostPlatform.system}.default;
nova-stats = self.packages.${pkgs.stdenv.hostPlatform.system}.nova-stats;
docs = self.packages.${pkgs.stdenv.hostPlatform.system}.docs;
qmllint =
pkgs.runCommand "nova-shell-qmllint"
{
nativeBuildInputs = [ pkgs.qt6.qtdeclarative ];
src = self;
}
''
cd $src
export QML_IMPORT_PATH="${pkgs.qt6.qtdeclarative}/lib/qt-6/qml:${
quickshell.packages.${pkgs.stdenv.hostPlatform.system}.default
}/lib/qt-6/qml"
qmllint -E \
-I shell/modules -I shell/services -I shell/applets -I shell/lock \
shell/shell.qml shell/modules/*.qml shell/services/*.qml \
shell/applets/*.qml shell/lock/*.qml \
> $TMPDIR/output.txt 2>&1 || true
# Extract unique warning messages (file:message, without line numbers)
grep -E "^Warning:" $TMPDIR/output.txt \
| sed 's/^Warning: //' \
| sed 's/\([^:]*\):[0-9]*:[0-9]*: /\1: /' \
| sort -u > $TMPDIR/current.txt
# Diff against known baseline - new warnings = failure
if ! diff -u test/qmllint-baseline.txt $TMPDIR/current.txt > $TMPDIR/diff.txt 2>&1; then
new=$(grep '^+[^+]' $TMPDIR/diff.txt || true)
if [ -n "$new" ]; then
echo "qmllint found new warnings not in baseline:"
echo "$new"
exit 1
fi
fi
cp $TMPDIR/output.txt $out
'';
nova-stats-clippy = (pkgs.callPackage ./nix/stats-daemon.nix { }).overrideAttrs (old: {
pname = "nova-stats-clippy";
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.clippy ];