about summary refs log tree commit diff
path: root/pkgs/tools/X11/caffeine-ng/default.nix
blob: 480f4b6e36e9ea22c78c89f334de8c635d94eb67 (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
{ fetchFromGitea
, meson
, ninja
, pkg-config
, scdoc
, gobject-introspection
, lib
, libayatana-appindicator
, libnotify
, python3Packages
, procps
, xset
, xautolock
, xscreensaver
, xfce
, wrapGAppsHook3
}:

python3Packages.buildPythonApplication rec {
  pname = "caffeine-ng";
  version = "4.2.0";
  format = "other";

  src = fetchFromGitea {
    domain = "codeberg.org";
    owner = "WhyNotHugo";
    repo = pname;
    rev = "v${version}";
    sha256 = "sha256-uYzLRZ+6ZgIwhSuJWRBpLYHgonX7sFXgUZid0V26V0Q=";
  };

  nativeBuildInputs = [ gobject-introspection meson ninja pkg-config wrapGAppsHook3 ];

  buildInputs = [
    libayatana-appindicator
    libnotify
  ];

  pythonPath = with python3Packages; [
    click
    dbus-python
    ewmh
    pulsectl
    pygobject3
    scdoc
    setproctitle
  ];

  dontWrapGApps = true;

  patches = [
    ./fix-build.patch
  ];

  postPatch = ''
    echo "${version}" > version
  '';

  postInstall = ''
    glib-compile-schemas $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";
    changelog = "https://codeberg.org/WhyNotHugo/caffeine-ng/src/tag/v${version}/CHANGELOG.rst";
    license = licenses.gpl3;
    platforms = platforms.linux;
  };
}