layer-shell-qt-nokde/shell.nix

34 lines
1009 B
Nix

{ pkgs ? import <nixpkgs> {} }: pkgs.mkShell {
nativeBuildInputs = with pkgs; [
cmake
wayland-scanner
libsForQt5.extra-cmake-modules
clang-tools_17
];
buildInputs = with pkgs; [
qt6.qtbase
qt6.qtdeclarative
qt6.qtwayland
wayland
wayland-protocols
];
shellHook = ''
export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc)
# Add Qt-related environment variables.
# https://discourse.nixos.org/t/qt-development-environment-on-a-flake-system/23707/5
setQtEnvironment=$(mktemp)
random=$(openssl rand -base64 20 | sed "s/[^a-zA-Z0-9]//g")
makeWrapper "$(type -p sh)" "$setQtEnvironment" "''${qtWrapperArgs[@]}" --argv0 "$random"
sed "/$random/d" -i "$setQtEnvironment"
source "$setQtEnvironment"
# qmlls does not account for the import path and bases its search off qtbase's path.
# The actual imports come from qtdeclarative. This directs qmlls to the correct imports.
export QMLLS_BUILD_DIRS=$(pwd)/build:$QML2_IMPORT_PATH
'';
}