Hi there, I’m trying to get Qt5 qmake installed on my system via configuration.nix, without resorting to qt5.full (which builds qtwebkit). I tried using NixOS stable and unstable.
I’ve already installed everything package from qt5.full and more:
qmake is in libsForQt5.qt5.qtbase.dev. Overall I suspect you rather want nix-shell or similar. systemPackages and nix-env are generally not suitable to pull dependencies for development (building, compiling, …)
Thank you. So it’s generally best practice to always open IDEs (like qtcreator and clion in this case) in a nix-shell that gets the needed dev packages?
Command-line build commands for sure. I’m not sure about IDEs in particular. I suspect they could be problematic to use that way (with --pure in particular). Maybe better try configuring them to run build-like commands inside a nix-shell but themselves to run in normal environment.
Things are just not designed for this purpose. It’s not just about pulling them. Even if you do, they normally won’t get into search paths for include files, etc.
That explains a lot why there was not path to “qmake”, thank you very much. You helped me a lot!
So the way to go would be a shell.nix for each project?
That’s usually what people do. But I can imagine using one big shell.nix that contains union of everything you need – or at least for a closely related set of projects.
When I use the nix-shell (with qmake, etc.) for building https://github.com/pbek/QOwnNotes, I’ve no issues using “qmake && make” in the terminal.
But when I use qtcreator in the nix-shell then qccreator complains about:
/nix/store/ph4hnl6f43jmfcvql72xwbqs7h852f59-qtx11extras-5.15.8-dev/include/QtX11Extras/qx11info_x11.h:46: error: xcb/xcb.h: No such file or directory
In file included from /nix/store/ph4hnl6f43jmfcvql72xwbqs7h852f59-qtx11extras-5.15.8-dev/include/QtX11Extras/QX11Info:1,
from ../src/libraries/qhotkey/QHotkey/qhotkey_x11.cpp:8:
/nix/store/ph4hnl6f43jmfcvql72xwbqs7h852f59-qtx11extras-5.15.8-dev/include/QtX11Extras/qx11info_x11.h:46:10: fatal error: xcb/xcb.h: No such file or directory
46 | #include <xcb/xcb.h>
| ^~~~~~~~~~~
When I use Clion in the nix-shell, I get a cmake error:
CMake Error at /nix/store/9d67jcm1wj09wqgffh8v5mkgil9psnrw-cmake-3.25.3/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find X11 (missing: X11_X11_INCLUDE_PATH X11_X11_LIB)
Call Stack (most recent call first):
/nix/store/9d67jcm1wj09wqgffh8v5mkgil9psnrw-cmake-3.25.3/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
/nix/store/9d67jcm1wj09wqgffh8v5mkgil9psnrw-cmake-3.25.3/share/cmake-3.25/Modules/FindX11.cmake:481 (find_package_handle_standard_args)
src/libraries/qhotkey/CMakeLists.txt:39 (find_package)
I’ve no issues using cmake in the nix-shell in the terminal.
Any ideas why IDEs don’t seem to find all files?
I already have all kind of stuff in my shell.nix for that project:
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
# nativeBuildInputs is usually what you want -- tools you need to run
nativeBuildInputs = [
pkgs.qt5.qtbase.dev
pkgs.qt5.qmake
pkgs.qt5.qtx11extras
pkgs.qt5.qtwebsockets
pkgs.qt5.qtdeclarative
pkgs.qt5.qtsvg
pkgs.xorg.libX11
pkgs.xorg.libX11.dev
pkgs.xorg.libxcb.dev
];
}