2021-03-13 19:07:02 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub
|
2023-02-08 22:03:59 +00:00
|
|
|
, dbus, cmake, pkg-config, wayland-scanner
|
2021-02-07 02:55:28 +00:00
|
|
|
, glib, udev, polkit, libusb1, libjpeg, libmodule
|
2020-11-24 15:29:28 +00:00
|
|
|
, pcre, libXdmcp, util-linux, libpthreadstubs
|
2019-07-04 16:34:26 +00:00
|
|
|
, enableDdc ? true, ddcutil
|
|
|
|
, enableDpms ? true, libXext
|
2021-02-07 02:55:28 +00:00
|
|
|
, enableGamma ? true, libdrm, libXrandr, wayland
|
2022-10-30 04:42:55 +00:00
|
|
|
, enableScreen ? true
|
|
|
|
, enableYoctolight ? true }:
|
2019-07-04 16:34:26 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "clightd";
|
2023-07-03 21:43:05 +00:00
|
|
|
version = "5.8";
|
2019-07-04 16:34:26 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "FedeDP";
|
|
|
|
repo = "Clightd";
|
|
|
|
rev = version;
|
2023-07-03 21:43:05 +00:00
|
|
|
hash = "sha256-Lmno/TJVCQVNzfpKNZzuDf2OM6w6rbz+zJTr3zVo/CM=";
|
2019-07-04 16:34:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# dbus-1.pc has datadir=/etc
|
|
|
|
SYSTEM_BUS_DIR = "${placeholder "out"}/share/dbus-1/system-services";
|
|
|
|
# polkit-gobject-1.pc has prefix=${polkit.out}
|
|
|
|
POLKIT_ACTION_DIR = "${placeholder "out"}/share/polkit-1/actions";
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
sed -i "s@pkg_get_variable(SYSTEM_BUS_DIR.*@set(SYSTEM_BUS_DIR $SYSTEM_BUS_DIR)@" CMakeLists.txt
|
|
|
|
sed -i "s@pkg_get_variable(POLKIT_ACTION_DIR.*@set(POLKIT_ACTION_DIR $POLKIT_ACTION_DIR)@" CMakeLists.txt
|
|
|
|
'';
|
|
|
|
|
2024-08-16 17:20:13 +00:00
|
|
|
cmakeFlags =
|
2021-03-13 19:07:02 +00:00
|
|
|
[ "-DSYSTEMD_SERVICE_DIR=${placeholder "out"}/lib/systemd/system"
|
|
|
|
"-DDBUS_CONFIG_DIR=${placeholder "out"}/etc/dbus-1/system.d"
|
|
|
|
# systemd.pc has prefix=${systemd.out}
|
|
|
|
"-DMODULE_LOAD_DIR=${placeholder "out"}/lib/modules-load.d"
|
2024-08-16 17:20:13 +00:00
|
|
|
] ++ lib.optional enableDdc "-DENABLE_DDC=1"
|
|
|
|
++ lib.optional enableDpms "-DENABLE_DPMS=1"
|
|
|
|
++ lib.optional enableGamma "-DENABLE_GAMMA=1"
|
|
|
|
++ lib.optional enableScreen "-DENABLE_SCREEN=1"
|
|
|
|
++ lib.optional enableYoctolight "-DENABLE_YOCTOLIGHT=1";
|
2019-07-04 16:34:26 +00:00
|
|
|
|
2023-02-08 22:03:59 +00:00
|
|
|
depsBuildBuild = [
|
|
|
|
pkg-config
|
|
|
|
];
|
|
|
|
|
2019-07-04 16:34:26 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
2021-01-17 02:09:27 +00:00
|
|
|
pkg-config
|
2023-02-08 22:03:59 +00:00
|
|
|
wayland-scanner
|
2019-07-04 16:34:26 +00:00
|
|
|
];
|
|
|
|
|
2024-08-16 17:20:13 +00:00
|
|
|
buildInputs = [
|
2023-04-23 11:04:34 +00:00
|
|
|
dbus
|
2019-07-04 16:34:26 +00:00
|
|
|
glib
|
|
|
|
udev
|
|
|
|
polkit
|
2021-02-07 02:55:28 +00:00
|
|
|
libusb1
|
|
|
|
libjpeg
|
2019-07-04 16:34:26 +00:00
|
|
|
libmodule
|
|
|
|
|
|
|
|
pcre
|
|
|
|
libXdmcp
|
2020-11-24 15:29:28 +00:00
|
|
|
util-linux
|
2019-07-04 16:34:26 +00:00
|
|
|
libpthreadstubs
|
2024-08-16 17:20:13 +00:00
|
|
|
] ++ lib.optionals enableDdc [ ddcutil ]
|
|
|
|
++ lib.optionals enableDpms [ libXext ]
|
|
|
|
++ lib.optionals enableGamma [ libXrandr ]
|
|
|
|
++ lib.optionals (enableDpms || enableGamma || enableScreen) [ libdrm wayland ];
|
2019-07-04 16:34:26 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/bin
|
2021-02-07 02:55:28 +00:00
|
|
|
ln -svT $out/libexec/clightd $out/bin/clightd
|
2019-07-04 16:34:26 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Linux bus interface that changes screen brightness/temperature";
|
2024-03-19 02:14:51 +00:00
|
|
|
mainProgram = "clightd";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://github.com/FedeDP/Clightd";
|
2019-07-04 16:34:26 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
license = licenses.gpl3;
|
|
|
|
maintainers = with maintainers; [
|
|
|
|
eadwu
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|