aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/pkgs/desktops/deepin/dde-kwin/default.nix
blob: ce1a1a8dda036b646a38da2099fdc776bbc5695b (plain)
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
{ stdenv
, mkDerivation
, pkgconfig
, fetchFromGitHub
, deepin
, cmake
, extra-cmake-modules
, qtbase
, libxcb
, kglobalaccel
, kwindowsystem
, kcoreaddons
, kwin
, dtkcore
, gsettings-qt
, fontconfig
, deepin-desktop-schemas
, glib
, libXrender
, mtdev
, qttools
, deepin-gettext-tools
, kwayland
, qtx11extras
, qtquickcontrols2
, epoxy
, qt5integration
, dde-session-ui
, dbus
, wrapGAppsHook
}:

mkDerivation rec {
  pname = "dde-kwin";
  version = "5.0.0";

  src = fetchFromGitHub {
    owner = "linuxdeepin";
    repo = pname;
    rev = version;
    sha256 = "0bvkx9h5ygj46a0j76kfyq3gvk6zn4fx6clhrmcr40hbi2k33cbl";
  };

  nativeBuildInputs = [
    cmake
    deepin-gettext-tools
    deepin.setupHook
    extra-cmake-modules
    pkgconfig
    wrapGAppsHook
  ];

  buildInputs = [
    deepin-desktop-schemas
    dtkcore
    epoxy
    fontconfig
    glib
    gsettings-qt
    kcoreaddons
    kglobalaccel
    kwayland
    kwin
    kwindowsystem
    libXrender
    libxcb
    mtdev
    qtbase
    qtquickcontrols2
    qttools
    qtx11extras
    qt5integration
  ];

  # Need to add kwayland around:
  # * https://github.com/linuxdeepin/dde-kwin/blob/5226bb984c844129f9fa589da56e77decb7b39a1/plugins/kwineffects/blur/CMakeLists.txt#L14
  NIX_CFLAGS_COMPILE = [
    "-I${kwayland.dev}/include/KF5"
  ];

  cmakeFlags = [
    "-DKWIN_VERSION=${(builtins.parseDrvName kwin.name).version}"
  ];

  patches = [
    ./0001-dde-kwin.pc-make-paths-relative.patch
    ./fix-paths.patch
  ];

  postPatch = ''
    searchHardCodedPaths

    patchShebangs translate_ts2desktop.sh \
      translate_generation.sh \
      translate_desktop2ts.sh \
      plugins/kwin-xcb/plugin/translate_generation.sh

    fixPath ${deepin-gettext-tools} /usr/bin/deepin-desktop-ts-convert translate_desktop2ts.sh translate_ts2desktop.sh

    fixPath $out /etc/xdg configures/CMakeLists.txt deepin-wm-dbus/deepinwmfaker.cpp

    # TODO: Need environmental patch
    fixPath /run/current-system/sw /usr/lib plugins/kwin-xcb/plugin/main.cpp

    substituteInPlace configures/kwin-wm-multitaskingview.desktop \
      --replace "dbus-send" "${dbus}/bin/dbus-send"

    fixPath ${dde-session-ui} /usr/lib/deepin-daemon/dde-warning-dialog deepin-wm-dbus/deepinwmfaker.cpp

    # Correct qt plugin installation path to be within dde-kwin prefix.
    substituteInPlace CMakeLists.txt \
      --subst-var-by plugin_path "$out/$qtPluginPrefix"
  '';

  postInstall = ''
    # Correct invalid path in .pc
    substituteInPlace $out/lib/pkgconfig/dde-kwin.pc \
      --replace "-L/usr/X11R6/lib64" ""

    chmod +x $out/bin/kwin_no_scale
  '';

  dontWrapQtApps = true;

  preFixup = ''
    gappsWrapperArgs+=(
      "''${qtWrapperArgs[@]}"
    )
  '';

  enableParallelBuilding = true;

  passthru.updateScript = deepin.updateScript { inherit pname version src; };

  meta = with stdenv.lib; {
    description = "KWin configuration for Deepin Desktop Environment";
    homepage = "https://github.com/linuxdeepin/dde-kwin";
    license = licenses.gpl3;
    platforms = platforms.linux;
    maintainers = with maintainers; [ romildo worldofpeace ];
  };
}