about summary refs log tree commit diff
path: root/pkgs/tools/misc/gummy/default.nix
blob: e2d600d8e2ee0cf4ceb43a399a021a67e1dd42ad (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
{ lib
, stdenv
, fetchFromGitea
, testers
, gummy
, cmake
, libX11
, libXext
, sdbus-cpp
, udev
, xcbutilimage
, coreutils
, cli11
, ddcutil
, fmt
, nlohmann_json
, spdlog
}:

stdenv.mkDerivation rec {
  pname = "gummy";
  version = "0.6.0";

  src = fetchFromGitea {
    domain = "codeberg.org";
    owner = "fusco";
    repo = "gummy";
    rev = version;
    hash = "sha256-kATieFf+dEpcYgSEPoETacP7R+u2dOrg7rOhIkNQ1uE=";
  };

  nativeBuildInputs = [
    cmake
  ];

  buildInputs = [
    cli11
    ddcutil
    fmt
    libX11
    libXext
    nlohmann_json
    sdbus-cpp
    spdlog
    udev
    xcbutilimage
  ];

  cmakeFlags = [
    "-DUDEV_DIR=${placeholder "out"}/lib/udev"
    "-DUDEV_RULES_DIR=${placeholder "out"}/lib/udev/rules.d"
  ];

  # Fixes the "gummy start" command, without this it cannot find the binary.
  # Setting this through cmake does not seem to work.
  postPatch = ''
    substituteInPlace gummyd/gummyd/api.cpp \
      --replace "CMAKE_INSTALL_DAEMON_PATH" "\"${placeholder "out"}/libexec/gummyd\""
  '';

  preFixup = ''
    substituteInPlace $out/lib/udev/rules.d/99-gummy.rules \
      --replace "/bin/chmod" "${coreutils}/bin/chmod"

    ln -s $out/libexec/gummyd $out/bin/gummyd
  '';

  passthru.tests.version = testers.testVersion { package = gummy; };

  meta = with lib; {
    homepage = "https://codeberg.org/fusco/gummy";
    description = "Brightness and temperature manager for X11";
    longDescription = ''
      CLI screen manager for X11 that allows automatic and manual brightness/temperature adjustments,
      via backlight (currently only for embedded displays) and gamma. Multiple monitors are supported.
    '';
    license = licenses.gpl3Only;
    maintainers = [ ];
  };
}