diff --git a/configuration.nix b/configuration.nix index 9f50e81..9d9f993 100644 --- a/configuration.nix +++ b/configuration.nix @@ -22,6 +22,7 @@ in ./hardware-configuration.nix # /etc/nixos/cachix.nix ]; + nyx.low-power.enable = true; nixpkgs.config.permittedInsecurePackages = [ "olm-3.2.16" @@ -359,12 +360,13 @@ in nvidiaBusId = lib.mkForce "PCI:01:00:0"; }; }; + hardware.enableAllFirmware = true; services.cpupower-gui.enable = true; services.upower.enable = true; services.power-profiles-daemon.enable = false; services.tlp = { enable = true; - USB_DENYLIST = "04d9:a0b8"; + # USB_DENYLIST = "04d9:a0b8"; }; # powerManagement.powertop.enable = true; # powerManagement.cpuFreqGovernor = "powersave"; diff --git a/flake.nix b/flake.nix index 3db169e..d00ea44 100644 --- a/flake.nix +++ b/flake.nix @@ -60,6 +60,7 @@ ./configuration.nix nix-index-database.nixosModules.nix-index { programs.nix-index-database.comma.enable = true; } + ./powersave.nix ]; }; diff --git a/hardware-configuration.nix b/hardware-configuration.nix index a69429e..b0c8075 100644 --- a/hardware-configuration.nix +++ b/hardware-configuration.nix @@ -1,6 +1,3 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. { config, lib, pkgs, modulesPath, ... }: { diff --git a/home.nix b/home.nix index 4c2721b..009c34e 100644 --- a/home.nix +++ b/home.nix @@ -1,4 +1,4 @@ -{ colmena, zen-browser, nix-gaming, nixpkgs-unstable,/* suyu, */hyprland-plugins/*, hyprland*/, ... }: +{ colmena, zen-browser, nix-gaming, nixpkgs-unstable, /* suyu, */hyprland-plugins/*, hyprland*/, ... }: { pkgs, inputs, ...}: let @@ -18,6 +18,7 @@ in stateVersion = "24.05"; packages = with pkgs; [ + postgresql upower usbutils killall diff --git a/powersave.nix b/powersave.nix new file mode 100644 index 0000000..2e13ed4 --- /dev/null +++ b/powersave.nix @@ -0,0 +1,109 @@ + +{ inputs, config, lib, pkgs, nixos-hardware, ... }: +{ + options = { + nyx.low-power.enable = + lib.mkEnableOption "enables low profile optimizations to reduce watt use"; + }; + imports = [ + nixos-hardware.nixosModules.common-gpu-nvidia-disable + ]; + config = lib.mkIf config.nyx.low-power.enable { + boot = { + kernelParams = [ + "pcie_aspm.policy=powersupersave" + "amd_pstate=passive" + "mitigations=auto" + ]; + + extraModprobeConfig = '' + # AMD iGPU tuning + options amdgpu dc=1 + options amdgpu deep_color=1 + options amdgpu aspm=1 + # Force dGPU off by default to save power (only use when explicitly requested) + options amdgpu runpm=1 + ''; + }; + + networking.networkmanager.wifi.powersave = true; + programs.sway.xwayland.enable = false; + services.pipewire.jack.enable = false; + powerManagement.enable = true; + powerManagement.cpuFreqGovernor = "schedutil"; + # powerManagement.cpuFreqGovernor = "powersave"; + services.power-profiles-daemon.enable = false; + + services.auto-cpufreq = { + enable = true; + settings = { + battery = { + governor = "powersave"; + turbo = "never"; + }; + charger = { + governor = "powersave"; + turbo = "auto"; + }; + }; + }; + + services.tlp = { + enable = true; + settings = { + TLP_DEFAULT_MODE = "BAT"; + CPU_SCALING_GOVERNOR_ON_AC = "schedutil"; + CPU_SCALING_GOVERNOR_ON_BAT = "schedutil"; + CPU_ENERGY_PERF_POLICY_ON_AC = "balance_power"; + CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; + PCIE_ASPM_ON_AC = "default"; + PCIE_ASPM_ON_BAT = "powersupersave"; + RUNTIME_PM_ON_AC = "auto"; + RUNTIME_PM_ON_BAT = "auto"; + USB_AUTOSUSPEND = "1"; + WIFI_PWR_ON_AC = "on"; + WIFI_PWR_ON_BAT = "on"; + DEVICES_TO_DISABLE_ON_BAT = "bluetooth"; + DEVICES_TO_DISABLE_ON_STARTUP = "bluetooth"; + DISK_IDLE_SECS_ON_AC = "60"; + DISK_IDLE_SECS_ON_BAT = "30"; + SATA_LINKPWR_ON_AC = "med_power_with_dipm"; + SATA_LINKPWR_ON_BAT = "min_power"; + SOUND_POWER_SAVE_ON_AC = "1"; + SOUND_POWER_SAVE_ON_BAT = "1"; + PLATFORM_PROFILE_ON_AC = "balanced"; + PLATFORM_PROFILE_ON_BAT = "low-power"; + }; + }; + powerManagement.powertop.enable = true; + services.thermald.enable = true; + + hardware = { + opengl = { + enable = true; + extraPackages = with pkgs; [ mesa ]; + }; + amdgpu.overdrive.enable = lib.mkForce false; + }; + + services.printing.enable = lib.mkForce false; + hardware.bluetooth.enable = lib.mkForce false; + services.avahi.enable = lib.mkForce false; + services.fwupd.enable = true; + services.locate.enable = false; + services.openssh.enable = lib.mkForce false; + programs.java.enable = lib.mkForce false; + services.upower.enable = lib.mkForce false; + services = { + xserver.windowManager.fvwm2.gestures = lib.mkForce false; + libinput.enable = lib.mkForce false; + }; + hardware.opentabletdriver.enable = lib.mkForce false; + programs.kdeconnect.enable = lib.mkForce false; + + virtualisation = { + # docker.enable = lib.mkForce false; + libvirtd.enable = lib.mkForce false; + }; + }; +} diff --git a/servers/eisen/configuration.nix b/servers/eisen/configuration.nix index e0a34e1..af9e4cd 100644 --- a/servers/eisen/configuration.nix +++ b/servers/eisen/configuration.nix @@ -116,6 +116,7 @@ in enable = true; settings.server.http_port = ports.grafana; }; + prometheus.enable = true; gitea = { enable = true;