1{ lib, stdenv, fetchFromGitHub, fetchpatch, autoreconfHook, coreutils }:
2
3stdenv.mkDerivation rec {
4 version = "1.2.2";
5 pname = "light";
6 src = fetchFromGitHub {
7 owner = "haikarainen";
8 repo = "light";
9 rev = "v${version}";
10 sha256 = "1a70zcf88ifsnwll486aicjnh48zisdf8f7vi34ihw61kdadsq9s";
11 };
12
13 patches = [
14 # Pull upstream fix for -fno-common toolchains:
15 # https://github.com/haikarainen/light/pull/135
16 (fetchpatch {
17 name = "fno-common.patch";
18 url = "https://github.com/haikarainen/light/commit/eae912ca7ff3356805e47739114861d2b6ae7ec0.patch";
19 sha256 = "15jp8hm5scl0myiy1jmvd6m52lhx5jscvi3rgb5siwakmnkgzx9j";
20 })
21 ];
22
23 configureFlags = [ "--with-udev" ];
24
25 nativeBuildInputs = [ autoreconfHook ];
26
27 # ensure udev rules can find the commands used
28 postPatch = ''
29 substituteInPlace 90-backlight.rules \
30 --replace '/bin/chgrp' '${coreutils}/bin/chgrp' \
31 --replace '/bin/chmod' '${coreutils}/bin/chmod'
32 '';
33
34 meta = {
35 description = "GNU/Linux application to control backlights";
36 homepage = "https://haikarainen.github.io/light/";
37 license = lib.licenses.gpl3;
38 maintainers = with lib.maintainers; [ puffnfresh dtzWill ];
39 platforms = lib.platforms.linux;
40 };
41}