From 782387d9dd84338e0c94974369b09ba9d3c9d2ec Mon Sep 17 00:00:00 2001 From: lucy Date: Sat, 18 Jul 2026 21:05:06 +0200 Subject: [PATCH] move power management options to laptop flake --- configuration.nix | 17 +--------- flake.nix | 22 ++++++++----- hardware-configuration-desktop.nix | 50 ------------------------------ hardware-configuration-laptop.nix | 33 -------------------- 4 files changed, 16 insertions(+), 106 deletions(-) delete mode 100644 hardware-configuration-desktop.nix delete mode 100644 hardware-configuration-laptop.nix diff --git a/configuration.nix b/configuration.nix index 3478218..569e0db 100644 --- a/configuration.nix +++ b/configuration.nix @@ -8,7 +8,7 @@ imports = [ ./stylix.nix ./nixvim/nixvim.nix - + /etc/nixos/hardware-configuration.nix ]; boot.loader.systemd-boot.enable = true; @@ -36,26 +36,11 @@ LC_TELEPHONE = "de_DE.UTF-8"; LC_TIME = "de_DE.UTF-8"; }; - services.upower.enable = true; - services.tlp = { - enable = true; - settings = { - CPU_SCALING_GOVERNOR_ON_AC = "performance"; - CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; - CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; - CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; - CPU_MIN_PERF_ON_AC = 0; - CPU_MAX_PERF_ON_AC = 100; - CPU_MIN_PERF_ON_BAT = 0; - CPU_MAX_PERF_ON_BAT = 20; - }; - }; services.xserver.xkb = { layout = "eu"; variant = ""; }; services.displayManager.ly.enable = true; - powerManagement.powertop.enable = true; programs.hyprland = { package = pkgs.hyprland; enable = true; diff --git a/flake.nix b/flake.nix index 6db0837..a1db0b6 100644 --- a/flake.nix +++ b/flake.nix @@ -57,10 +57,21 @@ } ({ lib, ... }: { networking.hostName = lib.mkForce "seele"; - imports = [ - ./hardware-configuration-laptop.nix - ]; - + powerManagement.powertop.enable = true; + services.upower.enable = true; + services.tlp = { + enable = true; + settings = { + CPU_SCALING_GOVERNOR_ON_AC = "performance"; + CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; + CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; + CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; + CPU_MIN_PERF_ON_AC = 0; + CPU_MAX_PERF_ON_AC = 100; + CPU_MIN_PERF_ON_BAT = 0; + CPU_MAX_PERF_ON_BAT = 20; + }; + }; }) ]; @@ -82,9 +93,6 @@ } ({ pkgs, lib, ... }: { - imports = [ - ./hardware-configuration-desktop.nix - ]; networking.hostName = lib.mkForce "nerv"; environment.systemPackages = [ # For debugging and troubleshooting Secure Boot. diff --git a/hardware-configuration-desktop.nix b/hardware-configuration-desktop.nix deleted file mode 100644 index da5f51c..0000000 --- a/hardware-configuration-desktop.nix +++ /dev/null @@ -1,50 +0,0 @@ -# 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, - ... -}: - -{ - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot.initrd.availableKernelModules = [ - "nvme" - "ahci" - "xhci_pci" - "usbhid" - "usb_storage" - "sd_mod" - ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = { - device = "/dev/disk/by-uuid/64a37727-0c5f-41d4-afac-dc26978916c1"; - fsType = "xfs"; - }; - - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/F424-0E3E"; - fsType = "vfat"; - options = [ - "fmask=0077" - "dmask=0077" - ]; - }; - - swapDevices = [ ]; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; - services.xserver.videoDrivers = [ "nvidia" ]; - hardware.nvidia.open = true; # see the note above - boot.loader.systemd-boot.configurationLimit = 5; -} diff --git a/hardware-configuration-laptop.nix b/hardware-configuration-laptop.nix deleted file mode 100644 index c3d407a..0000000 --- a/hardware-configuration-laptop.nix +++ /dev/null @@ -1,33 +0,0 @@ -# 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, ... }: - -{ - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "sdhci_pci" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { device = "/dev/disk/by-uuid/624609f3-6d1c-4e9c-adcb-0c4d66de25c3"; - fsType = "xfs"; - }; - - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/298C-5081"; - fsType = "vfat"; - options = [ "fmask=0077" "dmask=0077" ]; - }; - - swapDevices = - [ { device = "/dev/disk/by-uuid/9d98be55-ea0d-465f-967e-29c83c4127a9"; } - ]; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -}