module: add hardware/backlight
This commit is contained in:
parent
fed04d4028
commit
0d36b46ecc
2 changed files with 24 additions and 0 deletions
23
modules/modules/hardware/backlight.nix
Normal file
23
modules/modules/hardware/backlight.nix
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{ config, lib, pkgs, inputs, ... }:
|
||||||
|
with lib;
|
||||||
|
with lib.our;
|
||||||
|
with lib.hlissner;
|
||||||
|
let
|
||||||
|
cfg = config.modules.hardware.backlight;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.modules.hardware.backlight = with types; {
|
||||||
|
enable = mkBoolOpt false;
|
||||||
|
initialValue = mkOpt str "50%";
|
||||||
|
initialCommand = mkOpt str "${getMainProgram pkgs.brightnessctl} set ${cfg.initialValue}";
|
||||||
|
};
|
||||||
|
|
||||||
|
config.systemd.services = mkIf cfg.enable {
|
||||||
|
"set-initial-backlight" = {
|
||||||
|
description = "Sets the initial backlight status on startup";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
serviceConfig.Type = "oneshot";
|
||||||
|
script = cfg.initialCommand;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -21,6 +21,7 @@ in
|
||||||
modules.hardware = {
|
modules.hardware = {
|
||||||
wireless.enable = mkDefault true;
|
wireless.enable = mkDefault true;
|
||||||
audio.enable = mkDefault true;
|
audio.enable = mkDefault true;
|
||||||
|
backlight.enable = mkDefault true;
|
||||||
};
|
};
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue