diff --git a/configuration.nix b/configuration.nix index 4ea3369..f36aed2 100644 --- a/configuration.nix +++ b/configuration.nix @@ -133,6 +133,7 @@ # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ + set-backlight-script neovim git wget @@ -266,7 +267,7 @@ $NEW_PROMPT_COMMAND" toupper = "tr [:lower:] [:upper:]"; tolower = "tr [:upper:] [:lower:]"; rebuild = '' - sudo sh -c "cd $HOME/.local/os && nixos-rebuild switch --flake .# --use-remote-sudo" + nixos-rebuild switch --flake "$HOME/.local/os#" --use-remote-sudo ''; }; programs.bash.sessionVariables = { @@ -339,4 +340,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