module: add hardware/backlight

This commit is contained in:
Infinidoge 2022-04-08 18:56:21 -04:00
parent fed04d4028
commit 0d36b46ecc
2 changed files with 24 additions and 0 deletions

View 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;
};
};
}