about summary refs log tree commit diff
path: root/pkgs/misc/brightnessctl
diff options
context:
space:
mode:
authorMichael Weiss <dev.primeos@gmail.com>2019-10-24 14:54:40 +0200
committerMichael Weiss <dev.primeos@gmail.com>2020-02-09 23:52:32 +0100
commitcf5dd2623bb5518257d0edbb50a84093f08086bb (patch)
tree861bbefce032a7ca8ed593937377453be46ff1de /pkgs/misc/brightnessctl
parent2fc3322f321af12e957f61e298d749a90b4db939 (diff)
brightnessctl: Add systemd support
This makes it possible to use brightnessctl without udev rules / suid.
Diffstat (limited to 'pkgs/misc/brightnessctl')
-rw-r--r--pkgs/misc/brightnessctl/default.nix9
1 files changed, 7 insertions, 2 deletions
diff --git a/pkgs/misc/brightnessctl/default.nix b/pkgs/misc/brightnessctl/default.nix
index fc44689212908..387216e052f9a 100644
--- a/pkgs/misc/brightnessctl/default.nix
+++ b/pkgs/misc/brightnessctl/default.nix
@@ -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";