Qt development environment on a flake system

nix shell mainly just sets PATH so it is not similar to nix-shell, other than in name.

If you really want to use the new nix command, you will need something like the following:

nix develop --impure --expr 'let pkgs = import (builtins.getFlake "nixpkgs/nixos-unstable") {}; in pkgs.mkShell { nativeBuildInputs = with pkgs; [ libsForQt5.qt5.qmake ]; buildInputs = with pkgs; [ libsForQt5.qt5.qtserialport ]; }'

But just like the nix-shell, this is not enough. Qt also requires certain runtime environment so for actually running the program after building it, you will need to replicate the environment set by wrapQtAppsHook.

1 Like