2019-07-04 18:34:26 +02:00
|
|
|
{ lib, stdenv, fetchFromGitHub
|
|
|
|
, dbus, cmake, pkgconfig
|
|
|
|
, glib, udev, polkit, libmodule
|
|
|
|
, pcre, libXdmcp, utillinux, libpthreadstubs
|
|
|
|
, enableDdc ? true, ddcutil
|
|
|
|
, enableDpms ? true, libXext
|
|
|
|
, enableGamma ? true, libXrandr
|
|
|
|
, enableScreen ? true }:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "clightd";
|
2020-05-24 20:27:29 +02:00
|
|
|
version = "4.1";
|
2019-07-04 18:34:26 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "FedeDP";
|
|
|
|
repo = "Clightd";
|
|
|
|
rev = version;
|
2020-05-24 20:27:29 +02:00
|
|
|
sha256 = "0pqnn52nn22k49f5cw4jcr8vcbff28n56i8fizg1mmfshy8pn891";
|
2019-07-04 18:34:26 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
# dbus-1.pc has datadir=/etc
|
|
|
|
SYSTEM_BUS_DIR = "${placeholder "out"}/share/dbus-1/system-services";
|
|
|
|
# systemd.pc has prefix=${systemd.out}
|
|
|
|
MODULE_LOAD_DIR = "${placeholder "out"}/lib/modules-load.d";
|
|
|
|
# polkit-gobject-1.pc has prefix=${polkit.out}
|
|
|
|
POLKIT_ACTION_DIR = "${placeholder "out"}/share/polkit-1/actions";
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
sed -i "s@/etc@$out\0@" CMakeLists.txt
|
|
|
|
sed -i "s@pkg_get_variable(SYSTEM_BUS_DIR.*@set(SYSTEM_BUS_DIR $SYSTEM_BUS_DIR)@" CMakeLists.txt
|
|
|
|
sed -i "s@pkg_get_variable(MODULE_LOAD_DIR.*@set(MODULE_LOAD_DIR $MODULE_LOAD_DIR)@" CMakeLists.txt
|
|
|
|
sed -i "s@pkg_get_variable(POLKIT_ACTION_DIR.*@set(POLKIT_ACTION_DIR $POLKIT_ACTION_DIR)@" CMakeLists.txt
|
|
|
|
'';
|
|
|
|
|
|
|
|
cmakeFlags = with lib;
|
|
|
|
optional enableDdc "-DENABLE_DDC=1"
|
|
|
|
++ optional enableDpms "-DENABLE_DPMS=1"
|
|
|
|
++ optional enableGamma "-DENABLE_GAMMA=1"
|
|
|
|
++ optional enableScreen "-DENABLE_SCREEN=1";
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
dbus
|
|
|
|
cmake
|
|
|
|
pkgconfig
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = with lib; [
|
|
|
|
glib
|
|
|
|
udev
|
|
|
|
polkit
|
|
|
|
libmodule
|
|
|
|
|
|
|
|
pcre
|
|
|
|
libXdmcp
|
|
|
|
utillinux
|
|
|
|
libpthreadstubs
|
|
|
|
] ++ optional enableDdc ddcutil
|
|
|
|
++ optional enableDpms libXext
|
|
|
|
++ optional enableGamma libXrandr;
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
ln -svT $out/lib/clightd/clightd $out/bin/clightd
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Linux bus interface that changes screen brightness/temperature";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://github.com/FedeDP/Clightd";
|
2019-07-04 18:34:26 +02:00
|
|
|
platforms = platforms.linux;
|
|
|
|
license = licenses.gpl3;
|
|
|
|
maintainers = with maintainers; [
|
|
|
|
eadwu
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|