summaryrefslogtreecommitdiff
path: root/pkgs/by-name/nw/nwg-panel/package.nix
blob: fa7b790d2f013701c35c267b7ec3ecfc73d6c13a (about) (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
{
  lib,
  fetchFromGitHub,
  python3Packages,
  wrapGAppsHook3,
  gobject-introspection,
  gtk-layer-shell,
  pango,
  gdk-pixbuf,
  atk,
  # Extra packages called by various internal nwg-panel modules
  hyprland, # hyprctl
  sway, # swaylock, swaymsg
  systemd, # systemctl
  wlr-randr, # wlr-randr
  nwg-menu, # nwg-menu
  brightnessctl, # brightnessctl
  pamixer, # pamixer
  pulseaudio, # pactl
  libdbusmenu-gtk3, # tray
  playerctl,
}:

python3Packages.buildPythonApplication rec {
  pname = "nwg-panel";
  version = "0.10.1";

  src = fetchFromGitHub {
    owner = "nwg-piotr";
    repo = "nwg-panel";
    tag = "v${version}";
    hash = "sha256-ZQQRuYcctVKkE1GLx0VRAOZc0VTl1DuyR6y9CE5TbcE=";
  };

  # No tests
  doCheck = false;

  # Because of wrapGAppsHook3
  strictDeps = false;
  dontWrapGApps = true;

  buildInputs = [
    atk
    gdk-pixbuf
    gtk-layer-shell
    pango
    playerctl
  ];
  nativeBuildInputs = [
    wrapGAppsHook3
    gobject-introspection
  ];
  propagatedBuildInputs =
    (with python3Packages; [
      i3ipc
      netifaces
      psutil
      pybluez
      pygobject3
      requests
      dasbus
      setuptools
    ])
    # Run-time GTK dependency required by the Tray module
    ++ [ libdbusmenu-gtk3 ];

  postInstall = ''
    mkdir -p $out/share/{applications,pixmaps}
    cp $src/nwg-panel-config.desktop nwg-processes.desktop $out/share/applications/
    cp $src/nwg-shell.svg $src/nwg-panel.svg nwg-processes.svg $out/share/pixmaps/
  '';

  preFixup = ''
    makeWrapperArgs+=(
      "''${gappsWrapperArgs[@]}"
      --prefix XDG_DATA_DIRS : "$out/share"
      --prefix PATH : "${
        lib.makeBinPath [
          brightnessctl
          hyprland
          nwg-menu
          pamixer
          pulseaudio
          sway
          systemd
          wlr-randr
        ]
      }"
    )
  '';

  meta = {
    homepage = "https://github.com/nwg-piotr/nwg-panel";
    changelog = "https://github.com/nwg-piotr/nwg-panel/releases/tag/${src.tag}";
    description = "GTK3-based panel for Sway window manager";
    license = lib.licenses.mit;
    platforms = lib.platforms.linux;
    maintainers = with lib.maintainers; [ ludovicopiero ];
    mainProgram = "nwg-panel";
  };
}