You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Nix构建Fokus KDE plasmoid的CMake项目时找不到CMakeLists.txt问题

问题原因

报错核心是两个配置错误共同导致:

  1. 你设置了dontUnpack = true,Nix不会自动将拉取的源码解压到构建工作目录/build下
  2. 你没有指定CMake的源码根目录,CMake默认会在当前工作目录搜索CMakeLists.txt,自然找不到

解决方案

直接修改default.nix,移除错误配置,指定CMake的源码根目录即可,修改后的完整配置如下:

{ mkDerivation, lib, fetchFromGitLab, cmake, extra-cmake-modules
, plasma-framework
, qt5 }:

let
  version = "1.5.4";
  repo = fetchFromGitLab {
    owner = "divinae";
    repo = "focus-plasmoid";
    rev = "v${version}";
    sha256 = "19nndmqfzdcg7lzcifxa17m2mx85dlf4m2wxzr72gf78h4yj0ahv";
  };
in
  mkDerivation rec {
    inherit version;
    pname = "fokus";

    src = repo;
    cmakeRootDir = "packages";

    buildInputs  = [
      plasma-framework
      qt5.qtbase
    ];

    nativeBuildInputs = [ cmake extra-cmake-modules ];

    meta = with lib; {
      description = "Simple pomodoro timer plasmoid";
      homepage = "https://store.kde.org/p/1308861/";
      license = licenses.gpl3Only;
      maintainers = with maintainers; [  ];
      platforms = platforms.unix;
    };
  }

如果部分旧版本Nixpkgs中cmakeRootDir不生效,可将其替换为sourceRoot = "source/packages",效果一致。

内容的提问来源于stack exchange,提问作者GlinesMome

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.26 13:36:00