diff --git a/configuration.nix b/configuration.nix index b45c410..ad531fa 100644 --- a/configuration.nix +++ b/configuration.nix @@ -15,7 +15,7 @@ in { imports = [ # Include the results of the hardware scan. - ./hardware-configuration.nix + # ./hardware-configuration.nix ./system/system.nix # inputs.home-manager.nixosModules.default ]; diff --git a/system/hardware/configuration/hardware-configuration.nix b/system/hardware/configuration/hardware-configuration.nix new file mode 100644 index 0000000..afc3905 --- /dev/null +++ b/system/hardware/configuration/hardware-configuration.nix @@ -0,0 +1,37 @@ +# 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" "rtsx_pci_sdmmc"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-intel"]; + boot.extraModulePackages = []; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/05ca9d56-3506-43c5-b9ec-be928b782996"; + fsType = "ext4"; + }; + + swapDevices = []; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/system/hardware/hardware.nix b/system/hardware/hardware.nix new file mode 100644 index 0000000..b82e1c4 --- /dev/null +++ b/system/hardware/hardware.nix @@ -0,0 +1,10 @@ +{ + config, + pkgs, + ... +}: { + imports = [ + ./configuration/hardware-configuration.nix + ./power-management/default.nix + ]; +} diff --git a/system/hardware/power-management/default.nix b/system/hardware/power-management/default.nix new file mode 100644 index 0000000..3d746d4 --- /dev/null +++ b/system/hardware/power-management/default.nix @@ -0,0 +1,57 @@ +{pkgs, ...}: { + services.thermald.enable = true; + services.tlp = { + enable = true; + settings = { + # Performance Policy + CPU_SCALING_GOVERNOR_ON_AC = "performance"; + CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; + + # Intel-pstate gives sluggish performance + CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; + CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; + + # CPU Performance Caps + CPU_MIN_PERF_ON_AC = 0; + CPU_MIN_PERF_ON_BAT = 0; + + CPU_MAX_PERF_ON_AC = 100; + CPU_MAX_PERF_ON_BAT = 50; + + # Platform Profile + PLATFORM_PROFILE_ON_AC = "performance"; + PLATFORM_PROFILE_ON_BAT = "low-power"; + + # Boost + CPU_BOOST_ON_AC = 1; + CPU_BOOST_ON_BAT = 0; + + CPU_HWP_DYN_BOOST_ON_AC = 1; + CPU_HWP_DYN_BOOST_ON_BAT = 0; + + # Runtime Power Management + RUNTIME_PM_ON_AC = "auto"; + RUNTIME_PM_ON_BAT = "auto"; + + # PCIE ASPM, talking with PCIE devices to save power + PCIE_ASPM_ON_AC = "default"; + PCIE_ASPM_ON_BAT = "powersupersave"; + + # Suspend USB devices to save power + USB_AUTOSUSPEND = 1; + + # ~~Don't~~ disable bluetooth devices + USB_EXCLUDE_BTUSB = 0; + + # Wifi Power Save + WIFI_PWR_ON_AC = "off"; + WIFI_PWR_ON_BAT = "on"; + + # Hybrid Graphics Management + RUNTIME_PM_DRIVER_DENYLIST = "mei_me"; + + # MEM_SLEEP_ON_AC = "s2idle"; + MEM_SLEEP_ON_BAT = "deep"; + }; + }; +} diff --git a/system/system.nix b/system/system.nix index c02b192..dae29e6 100644 --- a/system/system.nix +++ b/system/system.nix @@ -7,5 +7,6 @@ ./wm/bspwm.nix ./services/services.nix ./fonts/fonts.nix + ./hardware/hardware.nix ]; }