Hey,
When running qmllint
in a shell with kdePackages.qtdeclarative
results in the following error:
Error
╰─>$ qmllint src/shell.qml
Warning: src/shell.qml: Warnings occurred while importing base modules: [import]
---
Warning: Failed to find the following builtins: builtins.qmltypes, jsroot.qmltypes (so will use qrc). Import paths used:
/home/ny/.config/quickshell
/nix/store/62rz6d59b1pi3pwx9yxc8q3aak2xlmz3-qtbase-6.7.2/lib/qt-6/qml [import]
---
Warning: src/shell.qml:1:1: Warnings occurred while importing module "Quickshell": [import]
import Quickshell
^^^^^^
---
Warning: Failed to import Quickshell. Are your import paths set up properly? [import]
---
Warning: src/shell.qml:5:1: Scope was not found. Did you add all import paths? [import]
^^^^^
Warning: src/shell.qml:4:1: ShellRoot was not found. Did you add all import paths? [import]
ShellRoot {
^^^^^^^^^
Warning: src/shell.qml:5:5: Cannot assign to non-existent default property [missing-property]
Bar {}
^^^
Which checks out, because /nix/store/62rz6d59b1pi3pwx9yxc8q3aak2xlmz3-qtbase-6.7.2/lib/qt-6/qml
does in fact not exist:
eza
╰─>$ eza -la /nix/store/62rz6d59b1pi3pwx9yxc8q3aak2xlmz3-qtbase-6.7.2/lib/qt-6/
dr-xr-xr-x - root 1 Jan 1970 plugins
Now when I provide the paths manually everything works normally:
Succesfull Linting
┬─[ny@marr:~/.c/quickshell]─[19:09:19]─[G:main=]─[nix-shell]
╰─>$ qmllint src/shell.qml -I /nix/store/1bwc1r6y30c7s32vi4dh9c3jwwlwmcjh-qtdeclarative-6.7.2/lib/qt-6/qml/ -I /nix/store/drqfbjn8cz93b0mvadld05dgiiwywban-quickshell-0.1.0/lib/qt-6/qml/
┬─[ny@marr:~/.c/quickshell]─[19:09:19]─[G:main=]─[nix-shell]
Same goes as well for qmlls, probably because it is using qmllint behind the scenes. Is this a known issue and is there a known solution ?
Thank you
1 Like
Sounds like a wrapping issue with the qmllint binary, maybe report that on the github repo itself:
1 Like
alright, thank you, open an issue here:
opened 04:29PM - 26 Aug 24 UTC
0.kind: bug
6.topic: qt/kde
### Describe the bug
Hey,
When running qmllint in a shell with kdePackages.… qtdeclarative results in the following error:
<details><summary>Error</summary>
<p>
```
╰─>$ qmllint src/shell.qml
Warning: src/shell.qml: Warnings occurred while importing base modules: [import]
---
Warning: Failed to find the following builtins: builtins.qmltypes, jsroot.qmltypes (so will use qrc). Import paths used:
/home/ny/.config/quickshell
/nix/store/62rz6d59b1pi3pwx9yxc8q3aak2xlmz3-qtbase-6.7.2/lib/qt-6/qml [import]
---
Warning: src/shell.qml:1:1: Warnings occurred while importing module "Quickshell": [import]
import Quickshell
^^^^^^
---
Warning: Failed to import Quickshell. Are your import paths set up properly? [import]
---
Warning: src/shell.qml:5:1: Scope was not found. Did you add all import paths? [import]
^^^^^
Warning: src/shell.qml:4:1: ShellRoot was not found. Did you add all import paths? [import]
ShellRoot {
^^^^^^^^^
Warning: src/shell.qml:5:5: Cannot assign to non-existent default property [missing-property]
Bar {}
^^^
```
</p>
</details>
Which checks out, because /nix/store/62rz6d59b1pi3pwx9yxc8q3aak2xlmz3-qtbase-6.7.2/lib/qt-6/qml does in fact not exist:
```console
╰─>$ eza -la /nix/store/62rz6d59b1pi3pwx9yxc8q3aak2xlmz3-qtbase-6.7.2/lib/qt-6/
dr-xr-xr-x - root 1 Jan 1970 plugins
```
Now when I provide the paths manually everything works normally:
```console
┬─[ny@marr:~/.c/quickshell]─[19:09:19]─[G:main=]─[nix-shell]
╰─>$ qmllint src/shell.qml -I /nix/store/1bwc1r6y30c7s32vi4dh9c3jwwlwmcjh-qtdeclarative-6.7.2/lib/qt-6/qml/ -I /nix/store/drqfbjn8cz93b0mvadld05dgiiwywban-quickshell-0.1.0/lib/qt-6/qml/
┬─[ny@marr:~/.c/quickshell]─[19:09:19]─[G:main=]─[nix-shell]
```
So autodiscovery of QML modules does not work I think.
### Steps To Reproduce
Steps to reproduce the behavior:
1. Enter a shell with kdePackages.qtdeclarative
2. run `qmllint file.qml`
3. ???
4. no profit
### Expected behavior
`qmllint` to pick up on QML modules such as the default one or also Quickshell's one.
### Notify maintainers
<!--
Please @ people who are in the `meta.maintainers` list of the offending package or module.
If in doubt, check `git blame` for whoever last touched something.
-->
@milahu
@NickCao
@LunNova
### Metadata
Please run `nix-shell -p nix-info --run "nix-info -m"` and paste the result.
```console
- system: `"x86_64-linux"`
- host os: `Linux 6.6.44, NixOS, 24.11 (Vicuna), 24.11.20240809.5e0ca22`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.18.5`
- channels(root): `"home-manager-23.11.tar.gz, nixos-23.11, nixos-unstable"`
- nixpkgs: `/nix/store/0jr2kk95c34c0b6yxi75q4fqgb43kqkm-source`
```
---
Add a :+1: [reaction] to [issues you find important].
[reaction]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/
[issues you find important]: https://github.com/NixOS/nixpkgs/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc