about summary refs log tree commit diff
path: root/pkgs/tools/X11/caffeine-ng/default.nix
blob: 344e3a892450eea6d588468709bc36d4860ecda0 (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
82
83
84
85
86
87
88
89
90
91
{ buildPythonApplication
, fetchPypi
, gobject-introspection
, gtk3
, lib
, libappindicator-gtk3
, libnotify
, click
, dbus-python
, ewmh
, pulsectl
, pygobject3
, pyxdg
, setproctitle
, python3
, procps
, xset
, xautolock
, xscreensaver
, xfce
, glib
, setuptools-scm
, wrapGAppsHook
}:

let
  click_7 = click.overridePythonAttrs (old: rec {
    version = "7.1.2";
    src = old.src.override {
      inherit version;
      hash = "sha256-0rUlXHxjSbwb0eWeCM0SrLvWPOZJ8liHVXg6qU37axo=";
    };
  });
in buildPythonApplication rec {
  pname = "caffeine-ng";
  version = "4.0.2";
  format = "setuptools";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-umIjXJ0et6Pi5Ejj96Q+ZhiKS+yj7bsgb4uQW6Ym6rU=";
  };

  nativeBuildInputs = [ wrapGAppsHook glib gobject-introspection setuptools-scm ];

  buildInputs = [
    libappindicator-gtk3
    libnotify
    gtk3
  ];

  pythonPath = [
    click_7
    dbus-python
    ewmh
    pulsectl
    pygobject3
    pyxdg
    setproctitle
  ];

  doCheck = false; # There are no tests.
  dontWrapGApps = true;
  strictDeps = false;

  postInstall = ''
    cp -r share $out/
    cp -r caffeine/assets/icons $out/share/

    # autostart file
    ln -s $out/${python3.sitePackages}/etc $out/etc

    glib-compile-schemas --strict $out/share/glib-2.0/schemas
  '';

  preFixup = ''
    gappsWrapperArgs+=(
      --prefix PATH : ${lib.makeBinPath [ procps xautolock xscreensaver xfce.xfconf xset ]}
    )
    makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
  '';

  meta = with lib; {
    mainProgram = "caffeine";
    maintainers = with maintainers; [ marzipankaiser ];
    description = "Status bar application to temporarily inhibit screensaver and sleep mode";
    homepage = "https://codeberg.org/WhyNotHugo/caffeine-ng";
    license = licenses.gpl3;
    platforms = platforms.linux;
  };
}