diff --git a/flake.nix b/flake.nix index ffcc356..96e28ad 100644 --- a/flake.nix +++ b/flake.nix @@ -4,7 +4,7 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-26.05"; nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable"; # used for some packages - + # Only uncomment when needed. This uses a lot of space and compute ressources for sometimes not that much. If not used, make it follow unstable nixpkgs-master.follows = "nixpkgs-unstable"; #nixpkgs-master.url = "github:nixos/nixpkgs/master"; # used with precaution as they are untested and not cached diff --git a/modules/applications/hyprland.nix b/modules/applications/hyprland.nix index e724657..3a277fc 100644 --- a/modules/applications/hyprland.nix +++ b/modules/applications/hyprland.nix @@ -211,8 +211,8 @@ #"Ctrl+Alt, 1, exec, swaync-client -t" # pos 4 1 notification center "Ctrl+Alt, 1, exec, qs ipc call notifications toggle" */ - # pos 4 1 notification center. - "Ctrl+Alt, 1, exec, caelestia shell drawers toggle sidebar" + # pos 4 1 notification center. + "Ctrl+Alt, 1, exec, caelestia shell drawers toggle sidebar" "Ctrl+Alt, 1, exec, [[ -f ~/.cache/hypr-battery-saver ]] || swaync-client -t" "Ctrl+$mod, 4, exec, caelestia shell notifs toggleDnd" "Ctrl+$mod, 3, exec, pavucontrol" # pos 1 2 audiocontrol diff --git a/modules/applications/mathematics.nix b/modules/applications/mathematics.nix index 2d8ce6e..e5cded2 100644 --- a/modules/applications/mathematics.nix +++ b/modules/applications/mathematics.nix @@ -3,5 +3,5 @@ _: { environment.systemPackages = with pkgs; [ elan ]; - }; + }; } diff --git a/modules/applications/waybar.nix b/modules/applications/waybar.nix index 9af7bcd..4567825 100644 --- a/modules/applications/waybar.nix +++ b/modules/applications/waybar.nix @@ -11,7 +11,7 @@ _: { "battery" "clock" ]; - + battery = { format = "{capacity}% {icon}"; states = { @@ -19,7 +19,7 @@ _: { critical = 15; }; }; - + clock = { format = "{:%H:%M}"; }; diff --git a/modules/applications/zsh.nix b/modules/applications/zsh.nix index 01b5c0e..cc40343 100644 --- a/modules/applications/zsh.nix +++ b/modules/applications/zsh.nix @@ -11,7 +11,7 @@ _: { caelestia-shell -n > /dev/null 2>&1 & disown fi ''; - + snrs = '' git -C ~/nixos add -A && time sudo nixos-rebuild switch --flake ~/nixos/#laptop && @@ -50,7 +50,7 @@ _: { command cat "$@" fi } - + custom-eza() { # behaves differently if we just call it or if we pipe initContent if [[ -t 1 ]]; then eza -hlF -aa --color=always --hyperlink --group-directories-first --show-symlinks --icons=always --git --no-permissions "$@" diff --git a/modules/hardware/battery.nix b/modules/hardware/battery.nix index a898d85..234ab2d 100644 --- a/modules/hardware/battery.nix +++ b/modules/hardware/battery.nix @@ -1,8 +1,9 @@ -{self, inputs, ...}: { - flake.nixosModules.battery-laptop = { - pkgs, - ... - }: +{ + self, + inputs, + ... +}: { + flake.nixosModules.battery-laptop = {pkgs, ...}: # https://discourse.nixos.org/t/what-is-the-best-option-for-power-management/63406/2 # we just activate tlp unconditonally #let @@ -21,7 +22,8 @@ # }; # config = lib.mkIf cfg.battery.enable { - /*powerManagement.powertop.enable = true; # enable powertop auto tuning on startup. + /* + powerManagement.powertop.enable = true; # enable powertop auto tuning on startup. # Acording to https://community.frame.work/t/solved-keys-stick-and-repeat-after-being-released/51153/12 # Some powertop bug is responsable for the problem of the random keypress being stuck # fix: from https://git.gabbie.blue/blue/nixconf/src/commit/2d1bc6dad4684c019b6b3e894408e76e2734806c/hosts/gabbielaptop/configuration.nix#L68 @@ -29,7 +31,8 @@ ${lib.getExe' config.systemd.package "udevadm"} trigger -c bind -s usb -a idVendor=32ac -a idProduct=0018 # Retrigger macropad udev rules ${lib.getExe' config.systemd.package "udevadm"} trigger -c bind -s usb -a idVendor=32ac -a idProduct=0013 - '';*/ + ''; + */ services.system76-scheduler.settings.cfsProfiles.enable = true; # Better scheduling for CPU cycles - thanks System76!!! services.thermald.enable = false; # Enable thermald, the temperature management daemon. (only necessary if on Intel CPUs) services.power-profiles-daemon.enable = false; # Disable GNOMEs power management @@ -49,9 +52,9 @@ STOP_CHARGE_THRESH_BAT1 = 80; }; }; - environment.systemPackages = [ - self.packages.${pkgs.system}.custom-performance - ]; + environment.systemPackages = [ + self.packages.${pkgs.system}.custom-performance + ]; }; perSystem = {pkgs, ...}: let NotifySound = ../../assets/battery_notify.mp3; @@ -344,21 +347,21 @@ ]; text = '' STATE="$HOME/.cache/hypr-battery-saver" - + enable() { mkdir -p "$(dirname "$STATE")" - + echo "Enabling battery saver mode..." - + # Save brightness brightnessctl get > "''${STATE}.brightness" 2>/dev/null || true - + # Kill heavy UI components pkill -f caelestia-shell || true pkill -f caelestia || true pkill shell || true pkill -f custom-wallpaper || true - + # Start lightweight notifications pkill swaync || true swaync & disown @@ -366,10 +369,10 @@ # Start lightweight waybar pkill waybar || true waybar & disown - + # Lower refresh rate (BIGGEST win) hyprctl keyword monitor "eDP-1,2560x1600@60,0x0,1" - + # Core performance toggles hyprctl --batch "\ keyword animations:enabled 0;\ @@ -384,45 +387,45 @@ keyword decoration:active_opacity 1;\ keyword decoration:inactive_opacity 1;\ keyword misc:vfr true" - + # Lower brightness brightnessctl set 5% 2>/dev/null || true - + touch "$STATE" - + notify-send "Battery Saver" "Enabled" } - + disable() { echo "Disabling battery saver mode..." - + # Restore refresh rate hyprctl keyword monitor "eDP-1,2560x1600@165,0x0,1" - + # Restore Caelestia pkill swaync || true pkill waybar || true caelestia shell -d >/dev/null 2>&1 & disown - + # Restart wallpaper custom-wallpaper >/dev/null 2>&1 & disown - + # Restore full UI via reload (safe here on exit) hyprctl reload - + # Restore brightness if [[ -f "''${STATE}.brightness" ]]; then brightnessctl set "$(cat "''${STATE}.brightness")" 2>/dev/null || true fi - + rm -f "$STATE" "''${STATE}.brightness" - + notify-send "Battery Saver" "Disabled" } - + if [[ -f "$STATE" ]]; then disable else diff --git a/modules/utilities/nixUtils.nix b/modules/utilities/nixUtils.nix index 36964b6..5078834 100644 --- a/modules/utilities/nixUtils.nix +++ b/modules/utilities/nixUtils.nix @@ -1,4 +1,8 @@ -{inputs, self, ...}: { +{ + inputs, + self, + ... +}: { flake.nixosModules.nixUtils-laptop = _: { # nixpkgs-review crashed my laptop multiple times. We must reduce how much ressources it can take. # for reference, my laptop is a 12 core ryzen 7