brightnessctl: Add systemd support

This makes it possible to use brightnessctl without udev rules / suid.
This commit is contained in:
Michael Weiss 2019-10-24 14:54:40 +02:00
parent 2fc3322f32
commit cf5dd2623b
No known key found for this signature in database
GPG Key ID: 5BE487C4D4771D83

View File

@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, coreutils }:
{ stdenv, fetchFromGitHub, coreutils, pkg-config, systemd }:
stdenv.mkDerivation rec {
pname = "brightnessctl";
@ -11,12 +11,17 @@ stdenv.mkDerivation rec {
sha256 = "0immxc7almmpg80n3bdn834p3nrrz7bspl2syhb04s3lawa5y2lq";
};
makeFlags = [ "PREFIX=" "DESTDIR=$(out)" ];
makeFlags = [ "PREFIX=" "DESTDIR=$(out)" "ENABLE_SYSTEMD=1" ];
postPatch = ''
substituteInPlace 90-brightnessctl.rules --replace /bin/ ${coreutils}/bin/
# For backward compatibility with the NixOS module / udev approach:
substituteInPlace Makefile --replace "INSTALL_UDEV_RULES=0" "INSTALL_UDEV_RULES=1"
'';
nativeBuildInputs = [ pkg-config ];
buildInputs = [ systemd ];
meta = with stdenv.lib; {
homepage = "https://github.com/Hummer12007/brightnessctl";
description = "This program allows you read and control device brightness";