title: Build a CMake project with Nix
body: <p>I'm trying to make a derivation from <a href="https://gitlab.com/divinae/focus-plasmoid" rel="nofollow noreferrer">fokus (a KDE plasmoid)</a>.</p>
  <p>I have a <code>default.nix</code> which looks like:</p>
  <pre><code>{ mkDerivation, lib, fetchFromGitLab, cmake, extra-cmake-modules
  , plasma-framework
  , qt5 }:
  
  let
    version = &quot;1.5.4&quot;;
    repo = fetchFromGitLab {
      owner = &quot;divinae&quot;;
      repo = &quot;focus-plasmoid&quot;;
      rev = &quot;v${version}&quot;;
      sha256 = &quot;19nndmqfzdcg7lzcifxa17m2mx85dlf4m2wxzr72gf78h4yj0ahv&quot;;
    };
  in
    mkDerivation rec {
      inherit version;
      pname = &quot;fokus&quot;;
  
      src = &quot;${repo}/packages&quot;;
      dontUnpack = true;
  
      buildInputs  = [
        plasma-framework
        qt5.qtbase
      ];
  
      nativeBuildInputs = [ cmake extra-cmake-modules ];
  
      meta = with lib; {
        description = &quot;Simple pomodoro timer plasmoid&quot;;
        homepage = &quot;https://store.kde.org/p/1308861/&quot;;
        license = licenses.gpl3Only;
        maintainers = with maintainers; [  ];
        platforms = platforms.unix;
      };
    }
  </code></pre>
  <p>I also added to <code>all-packages</code>:</p>
  <pre><code>fokus-plasma-applet = libsForQt5.callPackage ../applications/misc/fokus-plasma-applet { };
  </code></pre>
  <p>The thing is, I have only find few examples in nixpkgs, and I do not see what to do with this error (since <code>CMakeLists.txt</code> is effectively in <code>/package</code>):</p>
  <pre><code>building '/nix/store/c21h5667abmj4v0ci4n51ckvkxvc23gk-fokus-1.5.4.drv'...
  qtPreHook
  patching sources
  configuring
  fixing cmake files...
  cmake flags: -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=OFF -DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_SKIP_BUILD_RPATH=ON -DBUILD_TESTING=OFF -DCMAKE_INSTALL_LOCALEDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share/locale -DCMAKE_INSTALL_LIBEXECDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/libexec -DCMAKE_INSTALL_LIBDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/lib -DCMAKE_INSTALL_DOCDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share/doc/fokus -DCMAKE_INSTALL_INFODIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share/info -DCMAKE_INSTALL_MANDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share/man -DCMAKE_INSTALL_OLDINCLUDEDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/include -DCMAKE_INSTALL_INCLUDEDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/include -DCMAKE_INSTALL_SBINDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/sbin -DCMAKE_INSTALL_BINDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/bin -DCMAKE_INSTALL_NAME_DIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/lib -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_OSX_SYSROOT= -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_STRIP=/nix/store/4g5fidyk19akng9n91cql60ylrjq93s6-gcc-wrapper-10.3.0/bin/strip -DCMAKE_RANLIB=/nix/store/ffcrrgb6k5h7crr93dj90bi9fy1jvj16-binutils-2.35.1/bin/ranlib -DCMAKE_AR=/nix/store/ffcrrgb6k5h7crr93dj90bi9fy1jvj16-binutils-2.35.1/bin/ar -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_INSTALL_PREFIX=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4  -DKDE_INSTALL_EXECROOTDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4 -DKDE_INSTALL_BINDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/bin -DKDE_INSTALL_SBINDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/sbin -DKDE_INSTALL_LIBDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/lib -DKDE_INSTALL_LIBEXECDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/libexec -DKDE_INSTALL_CMAKEPACKAGEDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/lib/cmake -DKDE_INSTALL_INCLUDEDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/include -DKDE_INSTALL_LOCALSTATEDIR=/var -DKDE_INSTALL_DATAROOTDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share -DKDE_INSTALL_DATADIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share -DKDE_INSTALL_DOCBUNDLEDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share/doc/HTML -DKDE_INSTALL_KCFGDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share/config.kcfg -DKDE_INSTALL_KCONFUPDATEDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share/kconf_update -DKDE_INSTALL_KSERVICES5DIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share/kservices5 -DKDE_INSTALL_KSERVICETYPES5DIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share/kservicetypes5 -DKDE_INSTALL_KXMLGUI5DIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share/kxmlgui5 -DKDE_INSTALL_KNOTIFY5RCDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share/knotifications5 -DKDE_INSTALL_ICONDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share/icons -DKDE_INSTALL_LOCALEDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share/locale -DKDE_INSTALL_SOUNDDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share/sounds -DKDE_INSTALL_TEMPLATEDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share/templates -DKDE_INSTALL_WALLPAPERDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share/wallpapers -DKDE_INSTALL_APPDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share/applications -DKDE_INSTALL_DESKTOPDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share/desktop-directories -DKDE_INSTALL_MIMEDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share/mime/packages -DKDE_INSTALL_METAINFODIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share/appdata -DKDE_INSTALL_MANDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share/man -DKDE_INSTALL_INFODIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share/info -DKDE_INSTALL_DBUSDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share/dbus-1 -DKDE_INSTALL_DBUSINTERFACEDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share/dbus-1/interfaces -DKDE_INSTALL_DBUSSERVICEDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share/dbus-1/services -DKDE_INSTALL_DBUSSYSTEMSERVICEDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/share/dbus-1/system-services -DKDE_INSTALL_SYSCONFDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/etc -DKDE_INSTALL_CONFDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/etc/xdg -DKDE_INSTALL_AUTOSTARTDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/etc/xdg/autostart -DKDE_INSTALL_QTPLUGINDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/lib/qt-5.15.2/plugins -DKDE_INSTALL_PLUGINDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/lib/qt-5.15.2/plugins -DKDE_INSTALL_QMLDIR=/nix/store/5rdpaqmcj9hrpwdcnprr0zm51659mp08-fokus-1.5.4/lib/qt-5.15.2/qml 
  CMake Error: The source directory &quot;/build&quot; does not appear to contain CMakeLists.txt.
  Specify --help for usage, or press the help button on the CMake GUI.
  builder for '/nix/store/c21h5667abmj4v0ci4n51ckvkxvc23gk-fokus-1.5.4.drv' failed with exit code 1
  cannot build derivation '/nix/store/b9jhnh8bix892wql3qifvgf742lq41v9-system-path.drv': 1 dependencies couldn't be built
  cannot build derivation '/nix/store/3n3mwi7vqmnkng6r8kpa9881xdgcd253-nixos-system-looping-21.11pre328987.c935f5e0add.drv': 1 dependencies couldn't be built
  error: build of '/nix/store/3n3mwi7vqmnkng6r8kpa9881xdgcd253-nixos-system-looping-21.11pre328987.c935f5e0add.drv' failed
  </code></pre>