From c78cda2a1a882ef6f4b747a79e6e4cff7686e72d Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Sun, 30 Sep 2018 06:11:56 -0500 Subject: [PATCH 1/4] light: 1.1.2 -> 1.2, use new udev support instead of setuid wrapper. --- nixos/modules/programs/light.nix | 4 ++-- pkgs/os-specific/linux/light/default.nix | 21 +++++++++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/nixos/modules/programs/light.nix b/nixos/modules/programs/light.nix index 6f8c389acc9..93bfda481fe 100644 --- a/nixos/modules/programs/light.nix +++ b/nixos/modules/programs/light.nix @@ -13,7 +13,7 @@ in default = false; type = types.bool; description = '' - Whether to install Light backlight control with setuid wrapper. + Whether to install Light backlight control command and udev rules. ''; }; }; @@ -21,6 +21,6 @@ in config = mkIf cfg.enable { environment.systemPackages = [ pkgs.light ]; - security.wrappers.light.source = "${pkgs.light.out}/bin/light"; + services.udev.packages = [ pkgs.light ]; }; } diff --git a/pkgs/os-specific/linux/light/default.nix b/pkgs/os-specific/linux/light/default.nix index d500019c50b..1856c8861cc 100644 --- a/pkgs/os-specific/linux/light/default.nix +++ b/pkgs/os-specific/linux/light/default.nix @@ -1,26 +1,31 @@ -{ stdenv, fetchFromGitHub, help2man }: +{ stdenv, fetchFromGitHub, autoreconfHook, coreutils }: stdenv.mkDerivation rec { - version = "1.1.2"; + version = "1.2"; name = "light-${version}"; src = fetchFromGitHub { owner = "haikarainen"; repo = "light"; - rev = version; - sha256 = "0c934gxav9cgdf94li6dp0rfqmpday9d33vdn9xb2mfp4war9n4w"; + rev = "v${version}"; + sha256 = "1h286va0r1xgxlnxfaaarrj3qhxmjjsivfn3khwm0wq1mhkfihra"; }; - buildInputs = [ help2man ]; + configureFlags = [ "--with-udev" ]; - installPhase = "mkdir -p $out/bin; cp light $out/bin/"; + nativeBuildInputs = [ autoreconfHook ]; - preFixup = "make man; mkdir -p $out/man/man1; mv light.1.gz $out/man/man1"; + # ensure udev rules can find the commands used + postPatch = '' + substituteInPlace 90-backlight.rules \ + --replace '/bin/chgrp' '${coreutils}/bin/chgrp' \ + --replace '/bin/chmod' '${coreutils}/bin/chmod' + ''; meta = { description = "GNU/Linux application to control backlights"; homepage = https://haikarainen.github.io/light/; license = stdenv.lib.licenses.gpl3; - maintainers = with stdenv.lib.maintainers; [ puffnfresh ]; + maintainers = with stdenv.lib.maintainers; [ puffnfresh dtzWill ]; platforms = stdenv.lib.platforms.linux; }; } From 5cc251df89d0396202a4bf3fba8a3a133485265c Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Sun, 30 Sep 2018 21:16:56 -0500 Subject: [PATCH 2/4] light: user needs to be in the 'video' group --- nixos/modules/programs/light.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nixos/modules/programs/light.nix b/nixos/modules/programs/light.nix index 93bfda481fe..9f2a03e7e76 100644 --- a/nixos/modules/programs/light.nix +++ b/nixos/modules/programs/light.nix @@ -13,7 +13,8 @@ in default = false; type = types.bool; description = '' - Whether to install Light backlight control command and udev rules. + Whether to install Light backlight control command + and udev rules granting access to members of the "video" group. ''; }; }; From 6b68e6dabdd93b7c5f71d126eb6c946af3af9aa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 1 Oct 2018 07:31:21 +0100 Subject: [PATCH 3/4] nixos/doc: mention light module change in release notes --- nixos/doc/manual/release-notes/rl-1903.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nixos/doc/manual/release-notes/rl-1903.xml b/nixos/doc/manual/release-notes/rl-1903.xml index 1f26d4765b9..7a393edb8fb 100644 --- a/nixos/doc/manual/release-notes/rl-1903.xml +++ b/nixos/doc/manual/release-notes/rl-1903.xml @@ -105,6 +105,14 @@ rabbitmq-server. + + + The light module no longer use setuids binary, but + udev rules. As a consequence users of that module have to belong to the + video group in order to use the executable + (i.e. users.users.yourusername.extraGroups = ["video"];). + + From 7180706a66c205fd503bc8b8df378de39a8eb56d Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Mon, 1 Oct 2018 14:28:15 -0500 Subject: [PATCH 4/4] fix minor typo per reviewer feedback --- nixos/doc/manual/release-notes/rl-1903.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/doc/manual/release-notes/rl-1903.xml b/nixos/doc/manual/release-notes/rl-1903.xml index 7a393edb8fb..9cb5b93f27c 100644 --- a/nixos/doc/manual/release-notes/rl-1903.xml +++ b/nixos/doc/manual/release-notes/rl-1903.xml @@ -107,7 +107,7 @@ - The light module no longer use setuids binary, but + The light module no longer uses setuid binaries, but udev rules. As a consequence users of that module have to belong to the video group in order to use the executable (i.e. users.users.yourusername.extraGroups = ["video"];).