summary refs log tree commit diff
path: root/pkgs/development/libraries/qtstyleplugin-kvantum/default.nix
blob: 64f3b81edde980f884026b2da33d62ea4de4d005 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, qmake
, qtbase
, qtsvg
, qtx11extras ? null
, kwindowsystem ? null
, qtwayland
, libX11
, libXext
, qttools
, wrapQtAppsHook
, gitUpdater

, qt5Kvantum ? null
}:
let
  isQt6 = lib.versionAtLeast qtbase.version "6";
in
stdenv.mkDerivation rec {
  pname = "qtstyleplugin-kvantum${lib.optionalString isQt6 "6"}";
  version = "1.0.10";

  src = fetchFromGitHub {
    owner = "tsujan";
    repo = "Kvantum";
    rev = "V${version}";
    sha256 = "48Blio8qHLmXSKG0c1tphXSfiwQXs0Xqwxe187nM3Ro=";
  };

  nativeBuildInputs = [
    qmake
    qttools
    wrapQtAppsHook
  ];

  buildInputs = [
    qtbase
    qtsvg
    libX11
    libXext
  ] ++ lib.optionals (!isQt6) [ qtx11extras kwindowsystem ]
    ++ lib.optional isQt6 qtwayland;

  sourceRoot = "${src.name}/Kvantum";

  patches = [
    (fetchpatch {
      # add xdg dirs support
      url = "https://github.com/tsujan/Kvantum/commit/01989083f9ee75a013c2654e760efd0a1dea4a68.patch";
      hash = "sha256-HPx+p4Iek/Me78olty1fA0dUNceK7bwOlTYIcQu8ycc=";
      stripLen = 1;
    })
  ];

  postPatch = ''
    # Fix plugin dir
    substituteInPlace style/style.pro \
      --replace "\$\$[QT_INSTALL_PLUGINS]" "$out/$qtPluginPrefix"
  '';

  postInstall = lib.optionalString isQt6 ''
    # make default Kvantum themes available for Qt 6 apps
    mkdir -p "$out/share"
    ln -s "${qt5Kvantum}/share/Kvantum" "$out/share/Kvantum"
  '';

  passthru.updateScript = gitUpdater {
    rev-prefix = "V";
  };

  meta = with lib; {
    description = "SVG-based Qt5 theme engine plus a config tool and extra themes";
    homepage = "https://github.com/tsujan/Kvantum";
    license = licenses.gpl3Plus;
    platforms = platforms.linux;
    maintainers = with maintainers; [ romildo Scrumplex ];
  };
}