nixos-demo/os/hardware/macbook/clight/default.nix

102 lines
2.8 KiB
Nix
Raw Normal View History

2025-07-12 00:28:21 +02:00
{
config,
...
}:
{
services.clight = {
enable = if (config.beancloud.hardware.backlight.service == "clight" && config.beancloud.hardware.macbook) then true else false;
settings = {
verbose = true;
resumedelay = 30;
inhibit = {
disabled = false;
inhibit_docked = true;
inhibit_pm = true;
inhibit_bl = true;
};
backlight = {
disabled = true;
restore_on_exit = true;
no_smooth_transition = false;
trans_step = 0.05;
trans_timeout = 30;
trans_fixed = 0;
ac_timeouts = [ 600 2700 300 ];
batt_timeouts = [ 1200 5400 600 ];
shutter_threshold = 0.10;
no_auto_calibration = false;
pause_on_lid_closed = true;
capture_on_lid_opened = true;
};
sensor = {
ac_regression_points = [ 0.0 0.15 0.29 0.45 0.61 0.74 0.81 0.88 0.93 0.97 1.0 ];
batt_regression_points = [ 0.0 0.15 0.23 0.36 0.52 0.59 0.65 0.71 0.75 0.78 0.80 ];
devname = "";
settings = "";
captures = [ 5 5 ];
};
keyboard = {
disabled = false;
timeouts = [ 15 7 ];
ac_regression_points = [ 1.0 0.97 0.93 0.88 0.81 0.74 0.61 0.45 0.29 0.15 0.0 ];
batt_regression_points = [ 0.80 0.78 0.75 0.71 0.65 0.59 0.52 0.36 0.23 0.15 0.0 ];
};
gamma = {
disabled = true;
restore_on_exit = true;
no_smooth_transition = false;
trans_step = 50;
trans_timeout = 300;
long_transition = true;
ambient_gamma = false;
};
daytime = {
sunrise = "6:30";
sunset = "20:30";
event_duration = 1800;
sunrise_offset = 0;
sunset_offset = 0;
};
dimmer = rec {
disabled = false;
no_smooth_transition = [ false false ];
trans_steps = [ 0.01 0.08 ];
trans_timeouts =
let
# calculates a duration for each step between
# full brightness and the dimmed percentage
formula = duration: target: step: builtins.floor (duration / ((1 - target) / step));
in
[
(formula 2000 dimmed_pct (builtins.elemAt trans_steps 0))
(formula 250 dimmed_pct (builtins.elemAt trans_steps 1))
];
trans_fixed = [ 0 0 ];
timeouts = [ 30 15 ];
dimmed_pct = 0.2;
};
dpms = {
disabled = false;
timeouts = [ 900 300 ];
};
screen = {
disabled = true;
contrib = 0.2;
timeouts = [ 5 0 ];
};
};
};
location.latitude = if (config.beancloud.hardware.backlight.service == "clight" && config.beancloud.hardware.macbook) then 50.856289 else null;
location.longitude = if (config.beancloud.hardware.backlight.service == "clight" && config.beancloud.hardware.macbook) then 11.464202 else null;
}