How to get libsForQt5.qt5.qmake installed without qt5.full?

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:

qtcreator

qt5.qmake
libsForQt5.qt5.qt3d
libsForQt5.qt5.qtsensors
libsForQt5.qt5.qtserialport
libsForQt5.qt5.qtvirtualkeyboard
libsForQt5.qt5.qtwebchannel
libsForQt5.qt5.qtlottie
libsForQt5.qt5.qtvirtualkeyboard


libsForQt5.qt5.qtcharts
libsForQt5.qt5.qtconnectivity
libsForQt5.qt5.qtdeclarative
libsForQt5.qt5.qtdoc
libsForQt5.qt5.qtgraphicaleffects
libsForQt5.qt5.qtimageformats
libsForQt5.qt5.qtlocation
libsForQt5.qt5.qtmultimedia
libsForQt5.qt5.qtwebkit

libsForQt5.qt5.qtquickcontrols
libsForQt5.qt5.qtquickcontrols2
libsForQt5.qt5.qtscript 
libsForQt5.qt5.qttranslations 
libsForQt5.qt5.qtwebengine
libsForQt5.qt5.qtwebview

libsForQt5.qt5.qmake
libsForQt5.qt5.qttools
libsForQt5.qt5.qtbase
libsForQt5.qt5.qtdeclarative
libsForQt5.qt5.qtsvg
libsForQt5.qt5.qtwayland
libsForQt5.qt5.qtwebsockets
libsForQt5.qt5.qtx11extras
libsForQt5.qt5.qtxmlpatterns
libsForQt5.qt5.wrapQtAppsHook

None gave me the correct links to qmake…

@totoroot, do you maybe know a way to install qt5.full and omit a single package (like qtwebkit)?

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, …)

1 Like

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.

Thank you!

Just for my understanding as NixOS beginner, what is the issue with pulling the dev packages?

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.

1 Like

Thank you very much! Where would that global shell.nix be placed so that it is found from everywhere?

You can use nix-shell path/to/shell.nix Or you could e.g. make symlinks from every relevant directory.

Ok, thank you. So no special place for it in NixOS… :grin:

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
    ];
}

No idea, off the top of my head. I don’t know their mechanisms.

Thank you for all your help!

1 Like