How to create a Qt devShell?

I’ve found this: qt-example/flake.nix at d22be0e5580fee6f00bc2eb879ea00cd244bf706 · tfc/qt-example · GitHub

But it seems to just infinitely loop when I try to enter the shell. Is there a way that just uses environment variables or something to make the compiler aware of Qt? I wanted to use my default shell fish, not bash anyway.

Should be packages not buildInputs. And get rid of the funny shellHook.

Should something like this work?

  packages.default = pkgs.stdenv.mkDerivation {
    pname = "limo";
    version = "main";

    src = ./.;

    strictDeps = true;

    nativeBuildInputs = with pkgs; [
      cmake
      libsForQt5.wrapQtAppsHook
      pkg-config
    ];

    buildInputs = with pkgs; [
      jsoncpp
      libarchive
      libcpr
      libloot
      pugixml
      unrar

      libsForQt5.qtbase
      libsForQt5.qtsvg
      libsForQt5.qtwayland
    ];

    cmakeFlags =
      let
        inherit (pkgs.lib) cmakeBool cmakeFeature;
      in
      [
        (cmakeFeature "LIMO_INSTALL_PREFIX" (placeholder "out"))
        (cmakeBool "USE_SYSTEM_LIBUNRAR" true)
      ];

    meta.mainProgram = "limo";
  };

  make-shells.default = {
    packages =
      with pkgs;
      [
        clang-tools
        gcc
        gdb
        git
      ]
      ++ config.packages.default.nativeBuildInputs
      ++ config.packages.default.buildInputs;
  };
};

This is using flake-parts. It’s setting the following environment variables:

export +AR +AS +CC +CMAKE_INCLUDE_PATH +CMAKE_LIBRARY_PATH +CONFIG_SHELL +CXX +GETTEXTDATADIRS_FOR_BUILD +HOST_PATH +IN_NIX_SHELL +LD +NIXPKGS_CMAKE_PREFIX_PATH +NIX_BINTOOLS +NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_BUILD_CORES +NIX_BUILD_TOP +NIX_CC +NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_CFLAGS_COMPILE +NIX_ENFORCE_NO_NATIVE +NIX_HARDENING_ENABLE +NIX_LDFLAGS +NIX_PKG_CONFIG_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_STORE +NM +OBJCOPY +OBJDUMP +PKG_CONFIG +PKG_CONFIG_PATH +QMAKE +QMAKEMODULES +QMAKEPATH +RANLIB +READELF +SIZE +SOURCE_DATE_EPOCH +STRINGS +STRIP +TEMP +TEMPDIR +TMP +TMPDIR +XML_CATALOG_FILES +__structuredAttrs +buildInputs +buildPhase +builder +cmakeFlags +configureFlags +depsBuildBuild +depsBuildBuildPropagated +depsBuildTarget +depsBuildTargetPropagated +depsHostHost +depsHostHostPropagated +depsTargetTarget +depsTargetTargetPropagated +doCheck +doInstallCheck +dontAddDisableDepTrack +mesonFlags +name +nativeBuildInputs +out +outputs +patches +phases +preferLocalBuild +propagatedBuildInputs +propagatedNativeBuildInputs +shell +shellHook +stdenv +strictDeps +system ~PATH ~XDG_DATA_DIRS

clangd is still throwing up unknown type errors for Qt types though.