1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 cmake,
7 qmake,
8 qtbase,
9 qtsvg,
10 qtx11extras ? null, # Qt 5 only
11 kwindowsystem,
12 qtwayland,
13 libX11,
14 libXext,
15 qttools,
16 wrapQtAppsHook,
17 gitUpdater,
18
19 qt6Kvantum ? null,
20}:
21let
22 isQt5 = lib.versionOlder qtbase.version "6";
23in
24stdenv.mkDerivation (finalAttrs: {
25 pname = "qtstyleplugin-kvantum${lib.optionalString isQt5 "5"}";
26 version = "1.1.5";
27
28 src = fetchFromGitHub {
29 owner = "tsujan";
30 repo = "Kvantum";
31 rev = "V${finalAttrs.version}";
32 hash = "sha256-G1yqToqYVnV/ag//b4C3jUvh2ayIhV3bEavfhpiF0p0=";
33 };
34
35 nativeBuildInputs = [
36 cmake
37 qmake
38 qttools
39 wrapQtAppsHook
40 ];
41
42 buildInputs = [
43 qtbase
44 qtsvg
45 libX11
46 libXext
47 ]
48 ++ lib.optionals isQt5 [ qtx11extras ]
49 ++ lib.optionals (!isQt5) [
50 kwindowsystem
51 qtwayland
52 ];
53
54 sourceRoot = "${finalAttrs.src.name}/Kvantum";
55
56 patches = [
57 (fetchpatch {
58 # add xdg dirs support
59 url = "https://github.com/tsujan/Kvantum/commit/01989083f9ee75a013c2654e760efd0a1dea4a68.patch";
60 hash = "sha256-HPx+p4Iek/Me78olty1fA0dUNceK7bwOlTYIcQu8ycc=";
61 stripLen = 1;
62 })
63 ];
64
65 postPatch = ''
66 substituteInPlace style/CMakeLists.txt \
67 --replace-fail '"''${_Qt6_PLUGIN_INSTALL_DIR}/' "\"$out/$qtPluginPrefix/" \
68 --replace-fail '"''${_Qt5_PLUGIN_INSTALL_DIR}/' "\"$out/$qtPluginPrefix/"
69 '';
70
71 cmakeFlags = [
72 (lib.cmakeBool "ENABLE_QT5" isQt5)
73 ];
74
75 postInstall = lib.optionalString isQt5 ''
76 # make default Kvantum themes available for Qt 5 apps
77 mkdir -p "$out/share"
78 ln -s "${qt6Kvantum}/share/Kvantum" "$out/share/Kvantum"
79 '';
80
81 passthru.updateScript = gitUpdater {
82 rev-prefix = "V";
83 };
84
85 meta = {
86 description = "SVG-based Qt5 theme engine plus a config tool and extra themes";
87 homepage = "https://github.com/tsujan/Kvantum";
88 license = lib.licenses.gpl3Plus;
89 platforms = lib.platforms.linux;
90 maintainers = with lib.maintainers; [
91 romildo
92 Scrumplex
93 ];
94 };
95})