mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-30 17:43:42 +00:00
4f0dadbf38
After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
83 lines
2.2 KiB
Nix
83 lines
2.2 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
|
|
let
|
|
cfg = config.programs.light;
|
|
|
|
in
|
|
{
|
|
options = {
|
|
programs.light = {
|
|
|
|
enable = lib.mkOption {
|
|
default = false;
|
|
type = lib.types.bool;
|
|
description = ''
|
|
Whether to install Light backlight control command
|
|
and udev rules granting access to members of the "video" group.
|
|
'';
|
|
};
|
|
|
|
brightnessKeys = {
|
|
enable = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = false;
|
|
description = ''
|
|
Whether to enable brightness control with keyboard keys.
|
|
|
|
This is mainly useful for minimalistic (desktop) environments. You
|
|
may want to leave this disabled if you run a feature-rich desktop
|
|
environment such as KDE, GNOME or Xfce as those handle the
|
|
brightness keys themselves. However, enabling brightness control
|
|
with this setting makes the control independent of X, so the keys
|
|
work in non-graphical ttys, so you might want to consider using this
|
|
instead of the default offered by the desktop environment.
|
|
|
|
Enabling this will turn on {option}`services.actkbd`.
|
|
'';
|
|
};
|
|
|
|
step = lib.mkOption {
|
|
type = lib.types.int;
|
|
default = 10;
|
|
description = ''
|
|
The percentage value by which to increase/decrease brightness.
|
|
'';
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
environment.systemPackages = [ pkgs.light ];
|
|
services.udev.packages = [ pkgs.light ];
|
|
services.actkbd = lib.mkIf cfg.brightnessKeys.enable {
|
|
enable = true;
|
|
bindings =
|
|
let
|
|
light = "${pkgs.light}/bin/light";
|
|
step = builtins.toString cfg.brightnessKeys.step;
|
|
in
|
|
[
|
|
{
|
|
keys = [ 224 ];
|
|
events = [ "key" ];
|
|
# Use minimum brightness 0.1 so the display won't go totally black.
|
|
command = "${light} -N 0.1 && ${light} -U ${step}";
|
|
}
|
|
{
|
|
keys = [ 225 ];
|
|
events = [ "key" ];
|
|
command = "${light} -A ${step}";
|
|
}
|
|
];
|
|
};
|
|
};
|
|
}
|