From 7406df9cf8c84564ae967a25ec64fd0dfefcc47c Mon Sep 17 00:00:00 2001 From: Steph Date: Mon, 24 Oct 2022 13:34:49 +0200 Subject: [PATCH] aa --- configuration.nix | 26 ++++++++++++++++++++++++++ startup.sh | 6 ++++++ 2 files changed, 32 insertions(+) create mode 100755 startup.sh diff --git a/configuration.nix b/configuration.nix index a90b52c..661edb9 100644 --- a/configuration.nix +++ b/configuration.nix @@ -130,6 +130,7 @@ # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ + set-backlight-script neovim git wget @@ -335,4 +336,29 @@ $NEW_PROMPT_COMMAND" }; + + let set-backlight-script = (writeShellApplication { + name = "set-backlight-script"; + text = '' + #!/bin/sh + + for d in /sys/class/backlight/*; do + cd $d + echo $(( $(cat max_brightness) / 2)) > brightness + done + ''; + }); + in + systemd.services.99setbacklight = { + enable = true; + description = "bar"; + unitConfig = { + Type = "simple"; + }; + serviceConfig = { + ExecStart = "${set-backlight-script}"; + }; + wantedBy = [ "multi-user.target" ]; + }; + } diff --git a/startup.sh b/startup.sh new file mode 100755 index 0000000..298ff82 --- /dev/null +++ b/startup.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +for dev in /sys/class/backlight/* ; do + cd $dev + echo $(( $(cat max_brightness) / 2)) > brightness +done