From ebe79b2a737aeb56e39be64b913df0c38ddf285d Mon Sep 17 00:00:00 2001 From: Zynh Ludwig Date: Sat, 28 Dec 2024 07:30:11 -0800 Subject: [PATCH] backlight: module init --- modules/backlight.nix | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 modules/backlight.nix diff --git a/modules/backlight.nix b/modules/backlight.nix new file mode 100644 index 0000000..9cd3a4d --- /dev/null +++ b/modules/backlight.nix @@ -0,0 +1,23 @@ +{ pkgs, lib, ... }: + +{ + systemd.services.enable-screen = { + description = "disable screen"; + enable = true; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${pkgs.coreutils}/bin/cp /sys/class/backlight/intel_backlight/max_brightness /sys/class/backlight/intel_backlight/brightness"; + }; + }; + systemd.services.disable-screen = { + description = "disable screen"; + enable = true; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${lib.getExe pkgs.bash} -c '${pkgs.coreutils}/bin/echo 0 > /sys/class/backlight/intel_backlight/brightness'"; + }; + }; +} + +