From e51e56069ce649141062cb0bcb1ab30d2d591783 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Czy=C5=BC?= Date: Sun, 17 Nov 2024 11:16:19 +0100 Subject: [PATCH] feat: laptop optimizations --- flake.lock | 6 +- home/home.nix | 7 +- home/system/hyprland.nix | 108 ++++++++++++++++++++---------- hosts/default.nix | 141 ++++++++++++++++++++------------------- 4 files changed, 151 insertions(+), 111 deletions(-) diff --git a/flake.lock b/flake.lock index e8c85ae..50b4fa3 100644 --- a/flake.lock +++ b/flake.lock @@ -1133,11 +1133,11 @@ }, "nur": { "locked": { - "lastModified": 1731730181, - "narHash": "sha256-uCyImsva4NYsRywcT+U6cr+MZrXx/e4Gu8SqTujrCBY=", + "lastModified": 1731754035, + "narHash": "sha256-EyZZwZMs+zfI/NSOVPRh8kW1qljNJsPC11Y7fXLg9Gs=", "owner": "nix-community", "repo": "NUR", - "rev": "295cc9ee333bda9e7d58daae4d1c25fcdef3e5a6", + "rev": "48d49a916e13bcb6363d8d3ac4c5c862aea21b7c", "type": "github" }, "original": { diff --git a/home/home.nix b/home/home.nix index 4a416b8..f8c1edd 100644 --- a/home/home.nix +++ b/home/home.nix @@ -25,7 +25,7 @@ ./system/hyprland.nix ./system/rofi.nix ./system/stylix.nix - ./system/theme.nix + ./system/theme.nix ./system/waybar.nix ./system/wlsunset.nix ./system/wofi.nix @@ -54,7 +54,7 @@ ./system/hyprland.nix ./system/rofi.nix ./system/stylix.nix - ./system/theme.nix + ./system/theme.nix ./system/waybar.nix ./system/wlsunset.nix ./system/wofi.nix @@ -68,5 +68,6 @@ ./programs/helix.nix ./programs/fastfetch.nix ] - else [ ]; + else + [ ]; } diff --git a/home/system/hyprland.nix b/home/system/hyprland.nix index 18ee55e..47336c3 100644 --- a/home/system/hyprland.nix +++ b/home/system/hyprland.nix @@ -1,4 +1,10 @@ -{ lib, pkgs, inputs, ... }: +{ + lib, + pkgs, + inputs, + hostname, + ... +}: { # ------------------------------------------------ # Needed Packages @@ -268,6 +274,7 @@ ################ # See https://wiki.hyprland.org/Configuring/Monitors/ + monitor=, preferred, auto, 1 monitor=HDMI-A-1, preferred, 0x360, 1 monitor=DP-1, highrr, 4480x0, 1 monitor=DP-2, highrr, 1920x0, 1 @@ -659,48 +666,75 @@ after_sleep_cmd = "hyprctl dispatch dpms on"; }; - listener = [ + listener = + if hostname == "zion" then + [ + # { + # timeout = 60; + # on-timeout = "brightnessctl -sd asus::kbd_backlight set 0"; + # on-resume = "brightnessctl -rd asus::kbd_backlight"; + # } - # { - # timeout = 60; - # on-timeout = "brightnessctl -sd asus::kbd_backlight set 0"; - # on-resume = "brightnessctl -rd asus::kbd_backlight"; - # } + # { + # timeout = 80; + # on-timeout = "brightnessctl -s set 0"; + # on-resume = "brightnessctl -r"; + # } - # { - # timeout = 80; - # on-timeout = "brightnessctl -s set 0"; - # on-resume = "brightnessctl -r"; - # } + # { + # timeout = 100; + # on-timeout = "hyprctl dispatch dpms off "; + # on-resume = "hyprctl dispatch dpms on"; + # } - # { - # timeout = 100; - # on-timeout = "hyprctl dispatch dpms off "; - # on-resume = "hyprctl dispatch dpms on"; - # } + # { + # timeout = 150; + # on-timeout = "systemctl suspend"; + # } + { + timeout = 300; # 5min + on-timeout = "brightnessctl -s set 10"; # set monitor backlight to minimum, avoid 0 on OLED monitor. + on-resume = "brightnessctl -r"; # monitor backlight restore. + } - # { - # timeout = 150; - # on-timeout = "systemctl suspend"; - # } - { - timeout = 300; # 5min - on-timeout = "brightnessctl -s set 10"; # set monitor backlight to minimum, avoid 0 on OLED monitor. - on-resume = "brightnessctl -r"; # monitor backlight restore. - } + { + timeout = 600; # 10min + on-timeout = "loginctl lock-session"; # lock screen when timeout has passed + } - { - timeout = 600; # 10min - on-timeout = "loginctl lock-session"; # lock screen when timeout has passed - } + # { + # timeout = 1800; # 30min + # on-timeout = "systemctl hibernate"; + # on-timeout = hyprctl dispatch dpms off # screen off when timeout has passed + # on-resume = hyprctl dispatch dpms on # screen on when activity is detected after timeout has fired. + # } + ] + else if hostname == "thor" then + [ + { + timeout = 300; + on-timeout = "brightnessctl -s set 0"; + on-resume = "brightnessctl -r"; + } - # { - # timeout = 1800; # 30min - # on-timeout = "systemctl hibernate"; - # on-timeout = hyprctl dispatch dpms off # screen off when timeout has passed - # on-resume = hyprctl dispatch dpms on # screen on when activity is detected after timeout has fired. - # } - ]; + { + timeout = 400; # 10min + on-timeout = "loginctl lock-session"; # lock screen when timeout has passed + } + + { + timeout = 450; + on-timeout = "hyprctl dispatch dpms off "; + on-resume = "hyprctl dispatch dpms on"; + } + + { + timeout = 600; + on-timeout = "systemctl suspend"; + } + ] + else + [ ]; }; }; diff --git a/hosts/default.nix b/hosts/default.nix index 6cee019..58e0797 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,75 +1,80 @@ { hostname, ... }: { imports = - if hostname == "zion" then [ - ./zion.nix + if hostname == "zion" then + [ + ./zion.nix - ./modules/adb.nix - ./modules/ananicy.nix - # ./modules/bluetooth.nix - ./modules/boot.nix - ./modules/configuration.nix - ./modules/fstrim.nix - ./modules/gaming.nix - ./modules/greetd.nix - ./modules/gsettings.nix - # ./modules/kde.nix - # ./modules/lanzaboot.nix - ./modules/network.nix - ./modules/nh.nix - ./modules/nvidia.nix - ./modules/ollama.nix - ./modules/packages.nix - ./modules/pipewire.nix - ./modules/printing.nix - ./modules/remote-builder.nix - ./modules/security.nix - ./modules/ssh.nix - ./modules/users.nix - ./modules/vm.nix - ] - else if hostname == "thor" then [ - ./thor.nix + ./modules/adb.nix + ./modules/ananicy.nix + # ./modules/bluetooth.nix + ./modules/boot.nix + ./modules/configuration.nix + ./modules/fstrim.nix + ./modules/gaming.nix + ./modules/greetd.nix + ./modules/gsettings.nix + # ./modules/kde.nix + # ./modules/lanzaboot.nix + ./modules/network.nix + ./modules/nh.nix + ./modules/nvidia.nix + ./modules/ollama.nix + ./modules/packages.nix + ./modules/pipewire.nix + ./modules/printing.nix + ./modules/remote-builder.nix + ./modules/security.nix + ./modules/ssh.nix + ./modules/users.nix + ./modules/vm.nix + ] + else if hostname == "thor" then + [ + ./thor.nix - ./modules/adb.nix - ./modules/ananicy.nix - ./modules/bluetooth.nix - ./modules/boot.nix - ./modules/configuration.nix - ./modules/distributed-builds.nix - ./modules/fstrim.nix - ./modules/gaming.nix - ./modules/greetd.nix - ./modules/gsettings.nix - # ./modules/kde.nix - # ./modules/lanzaboot.nix - ./modules/network.nix - ./modules/nh.nix - # ./modules/nvidia.nix - ./modules/ollama.nix - ./modules/packages.nix - ./modules/pipewire.nix - ./modules/printing.nix - ./modules/security.nix - ./modules/ssh.nix - ./modules/users.nix - ./modules/vm.nix - ] - else if hostname == "server" then [ - ./server.nix + ./modules/adb.nix + ./modules/ananicy.nix + ./modules/bluetooth.nix + ./modules/boot.nix + ./modules/configuration.nix + ./modules/distributed-builds.nix + ./modules/fstrim.nix + ./modules/gaming.nix + ./modules/greetd.nix + ./modules/gsettings.nix + # ./modules/kde.nix + # ./modules/lanzaboot.nix + ./modules/network.nix + ./modules/nh.nix + # ./modules/nvidia.nix + ./modules/ollama.nix + ./modules/packages.nix + ./modules/pipewire.nix + ./modules/printing.nix + ./modules/security.nix + ./modules/ssh.nix + ./modules/tlp.nix + ./modules/users.nix + ./modules/vm.nix + ] + else if hostname == "server" then + [ + ./server.nix - ./modules/nh.nix - ./modules/tlp.nix - ./modules/ssh.nix - ./modules/boot.nix - ./modules/users.nix - ./modules/nvidia.nix - ./modules/ollama.nix - ./modules/fstrim.nix - ./modules/system.nix - ./modules/network.nix - ./modules/configuration.nix - #./modules/lanzaboot.nix - ] - else [ ]; + ./modules/nh.nix + ./modules/tlp.nix + ./modules/ssh.nix + ./modules/boot.nix + ./modules/users.nix + ./modules/nvidia.nix + ./modules/ollama.nix + ./modules/fstrim.nix + ./modules/system.nix + ./modules/network.nix + ./modules/configuration.nix + #./modules/lanzaboot.nix + ] + else + [ ]; }