1 { lib, stdenv, fetchFromGitHub
2 , dbus, cmake, pkg-config, wayland-scanner
3 , glib, udev, polkit, libusb1, libjpeg, libmodule
4 , pcre, libXdmcp, util-linux, libpthreadstubs
5 , enableDdc ? true, ddcutil
6 , enableDpms ? true, libXext
7 , enableGamma ? true, libdrm, libXrandr, wayland
9 , enableYoctolight ? true }:
11 stdenv.mkDerivation rec {
15 src = fetchFromGitHub {
19 hash = "sha256-Lmno/TJVCQVNzfpKNZzuDf2OM6w6rbz+zJTr3zVo/CM=";
22 # dbus-1.pc has datadir=/etc
23 SYSTEM_BUS_DIR = "${placeholder "out"}/share/dbus-1/system-services";
24 # polkit-gobject-1.pc has prefix=${polkit.out}
25 POLKIT_ACTION_DIR = "${placeholder "out"}/share/polkit-1/actions";
28 sed -i "s@pkg_get_variable(SYSTEM_BUS_DIR.*@set(SYSTEM_BUS_DIR $SYSTEM_BUS_DIR)@" CMakeLists.txt
29 sed -i "s@pkg_get_variable(POLKIT_ACTION_DIR.*@set(POLKIT_ACTION_DIR $POLKIT_ACTION_DIR)@" CMakeLists.txt
33 [ "-DSYSTEMD_SERVICE_DIR=${placeholder "out"}/lib/systemd/system"
34 "-DDBUS_CONFIG_DIR=${placeholder "out"}/etc/dbus-1/system.d"
35 # systemd.pc has prefix=${systemd.out}
36 "-DMODULE_LOAD_DIR=${placeholder "out"}/lib/modules-load.d"
37 ] ++ lib.optional enableDdc "-DENABLE_DDC=1"
38 ++ lib.optional enableDpms "-DENABLE_DPMS=1"
39 ++ lib.optional enableGamma "-DENABLE_GAMMA=1"
40 ++ lib.optional enableScreen "-DENABLE_SCREEN=1"
41 ++ lib.optional enableYoctolight "-DENABLE_YOCTOLIGHT=1";
66 ] ++ lib.optionals enableDdc [ ddcutil ]
67 ++ lib.optionals enableDpms [ libXext ]
68 ++ lib.optionals enableGamma [ libXrandr ]
69 ++ lib.optionals (enableDpms || enableGamma || enableScreen) [ libdrm wayland ];
73 ln -svT $out/libexec/clightd $out/bin/clightd
77 description = "Linux bus interface that changes screen brightness/temperature";
78 mainProgram = "clightd";
79 homepage = "https://github.com/FedeDP/Clightd";
80 platforms = platforms.linux;
81 license = licenses.gpl3;
82 maintainers = with maintainers; [