3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/applications/misc/clight/clightd.nix

87 lines
2.4 KiB
Nix
Raw Normal View History

2021-02-07 02:55:28 +00:00
{ lib, stdenv, fetchFromGitHub, fetchpatch
, dbus, cmake, pkg-config
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 17:34:26 +01:00
, enableDdc ? true, ddcutil
, enableDpms ? true, libXext
2021-02-07 02:55:28 +00:00
, enableGamma ? true, libdrm, libXrandr, wayland
2019-07-04 17:34:26 +01:00
, enableScreen ? true }:
stdenv.mkDerivation rec {
pname = "clightd";
2021-02-07 02:55:28 +00:00
version = "5.1";
2019-07-04 17:34:26 +01:00
src = fetchFromGitHub {
owner = "FedeDP";
repo = "Clightd";
rev = version;
2021-02-07 02:55:28 +00:00
sha256 = "sha256-BEGum0t+FrCTAEQwTsWeYpoIqimTAz+Bv/ZQPQ3fePY=";
2019-07-04 17:34:26 +01:00
};
2021-02-07 02:55:28 +00:00
patches = [
# Not needed by next version bump
(fetchpatch {
url = "https://github.com/FedeDP/Clightd/commit/a52a2888e3798c572dad359a017cb0d40e7c5fb7.patch";
sha256 = "sha256-nUzNBia1EvBQxinAfjyKbuldBoHLY1hfMaxgG2lKQWg=";
})
];
2019-07-04 17:34:26 +01: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
pkg-config
2019-07-04 17:34:26 +01:00
];
buildInputs = with lib; [
glib
udev
polkit
2021-02-07 02:55:28 +00:00
libusb1
libjpeg
2019-07-04 17:34:26 +01:00
libmodule
pcre
libXdmcp
2020-11-24 15:29:28 +00:00
util-linux
2019-07-04 17:34:26 +01:00
libpthreadstubs
2021-02-07 02:55:28 +00:00
] ++ optionals enableDdc [ ddcutil ]
++ optionals enableDpms [ libXext ]
++ optionals enableGamma [ libXrandr ]
++ optionals (enableDpms || enableGamma || enableScreen) [ libdrm wayland ];
2019-07-04 17:34:26 +01: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 17:34:26 +01:00
'';
meta = with lib; {
description = "Linux bus interface that changes screen brightness/temperature";
homepage = "https://github.com/FedeDP/Clightd";
2019-07-04 17:34:26 +01:00
platforms = platforms.linux;
license = licenses.gpl3;
maintainers = with maintainers; [
eadwu
];
};
}