about summary refs log tree commit diff
path: root/pkgs/desktops/xfce/panel-plugins/xfce4-dockbarx-plugin/default.nix
blob: 8e8da34856386a73d53f680c80f1c542ed80bf2f (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
{ lib
, stdenv
, fetchFromGitHub
, bash
, cmake
, dockbarx
, gobject-introspection
, keybinder3
, pkg-config
, python3Packages
, wrapGAppsHook3
, xfce
}:

stdenv.mkDerivation rec {
  pname = "xfce4-dockbarx-plugin";
  version = "0.7.2";

  src = fetchFromGitHub {
    owner = "xuzhen";
    repo = "xfce4-dockbarx-plugin";
    rev = "v${version}";
    sha256 = "sha256-ZxaWORqA8LiM4CzakxClg5C6AsyHrzCGydgboCrC45g=";
  };

  pythonPath = [
    dockbarx
    python3Packages.pygobject3
  ];

  nativeBuildInputs = [
    cmake
    gobject-introspection
    pkg-config
    python3Packages.wrapPython
    wrapGAppsHook3
  ];

  buildInputs = [
    keybinder3
    python3Packages.python
    xfce.xfce4-panel
    xfce.xfconf
  ]
  ++ pythonPath;

  postPatch = ''
    # We execute the wrapped xfce4-panel-plug directly.
    # Since argv is used for g_free() we also need to shift the indexes.
    substituteInPlace src/xfce_panel_plugin.c \
      --replace '"python3",' "" \
      --replace "g_free(argv[3]);" "g_free(argv[2]);" \
      --replace "g_free(argv[5]);" "g_free(argv[4]);"

    patchShebangs src/xfce4-dockbarx-plug.py
  '';

  postFixup = ''
    makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
    chmod +x $out/share/dockbarx/xfce4-panel-plug
    wrapPythonProgramsIn "$out/share/dockbarx" "$out $pythonPath"
  '';

  meta = with lib; {
    homepage = "https://github.com/xuzhen/xfce4-dockbarx-plugin";
    description = "Plugins to embed DockbarX into xfce4-panel";
    license = licenses.mit;
    platforms = platforms.linux;
    maintainers = with maintainers; [ ] ++ teams.xfce.members;
  };
}