From 6f634e3c3abdffdaac9405c872f683f4fcf465fe Mon Sep 17 00:00:00 2001 From: Kranium Gikos Mendoza Date: Mon, 11 May 2015 01:57:15 +0800 Subject: [PATCH] Add kbdlight package and setuid wrapper update nixos/modules/programs/kbdlight.nix to use mkEnableOption --- lib/maintainers.nix | 1 + nixos/modules/module-list.nix | 1 + nixos/modules/programs/kbdlight.nix | 16 +++++++++++++ pkgs/os-specific/linux/kbdlight/default.nix | 26 +++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 5 files changed, 46 insertions(+) create mode 100644 nixos/modules/programs/kbdlight.nix create mode 100644 pkgs/os-specific/linux/kbdlight/default.nix diff --git a/lib/maintainers.nix b/lib/maintainers.nix index 6906abd2c78c..b1d44ba51474 100644 --- a/lib/maintainers.nix +++ b/lib/maintainers.nix @@ -221,6 +221,7 @@ winden = "Antonio Vargas Gonzalez "; wizeman = "Ricardo M. Correia "; wjlroe = "William Roe "; + womfoo = "Kranium Gikos Mendoza "; wkennington = "William A. Kennington III "; wmertens = "Wout Mertens "; wscott = "Wayne Scott "; diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index bf70715cea4c..959d19a25ab6 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -62,6 +62,7 @@ ./programs/environment.nix ./programs/info.nix ./programs/ibus.nix + ./programs/kbdlight.nix ./programs/light.nix ./programs/nano.nix ./programs/screen.nix diff --git a/nixos/modules/programs/kbdlight.nix b/nixos/modules/programs/kbdlight.nix new file mode 100644 index 000000000000..0172368e968f --- /dev/null +++ b/nixos/modules/programs/kbdlight.nix @@ -0,0 +1,16 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.programs.kbdlight; + +in +{ + options.programs.kbdlight.enable = mkEnableOption "kbdlight"; + + config = mkIf cfg.enable { + environment.systemPackages = [ pkgs.kbdlight ]; + security.setuidPrograms = [ "kbdlight" ]; + }; +} diff --git a/pkgs/os-specific/linux/kbdlight/default.nix b/pkgs/os-specific/linux/kbdlight/default.nix new file mode 100644 index 000000000000..1bc07f357a8a --- /dev/null +++ b/pkgs/os-specific/linux/kbdlight/default.nix @@ -0,0 +1,26 @@ +{ stdenv, fetchFromGitHub }: + +stdenv.mkDerivation rec { + name = "kbdlight-${version}"; + version = "1.3"; + + src = fetchFromGitHub { + owner = "hobarrera"; + repo = "kbdlight"; + rev = "v${version}"; + sha256 = "1f08aid1xrbl4sb5447gkip9lnvkia1c4ap0v8zih5s9w8v72bny"; + }; + + preConfigure = '' + substituteInPlace Makefile \ + --replace /usr/local $out + ''; + + meta = with stdenv.lib; { + homepage = https://github.com/hobarrera/kbdlight; + description = "A very simple application that changes MacBooks' keyboard backlight level"; + license = licenses.isc; + maintainers = [ maintainers.womfoo ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 739878d1a743..4e713f0c91a9 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9155,6 +9155,8 @@ let kbd = callPackage ../os-specific/linux/kbd { }; + kbdlight = callPackage ../os-specific/linux/kbdlight { }; + kmscon = callPackage ../os-specific/linux/kmscon { }; latencytop = callPackage ../os-specific/linux/latencytop { };