dumpyourvms: swap, cpu schedutil, powersaving

This commit is contained in:
teutat3s 2022-01-05 23:16:35 +01:00
parent 73739322fa
commit 1f2a6fe066
Signed by: teutat3s
GPG key ID: 4FA1D3FA524F22C1
5 changed files with 54 additions and 11 deletions

View file

@ -3,4 +3,4 @@
# Example:
# exec swayidle
#exec qMasterPassword
exec qMasterPassword

View file

@ -19,8 +19,13 @@ in
pub-solar.virtualisation.enable = true;
# fix backlight for keyboard and brightness, adjust function key binding
boot.kernelParams = [ "acpi_backlight=video" "hid_apple.fnmode=2" "intel_pstate=active" ];
boot.kernelParams = [ "acpi_backlight=video" "hid_apple.fnmode=2" "intel_pstate=passive" "resume_offset=47366144" ];
boot.loader.efi.canTouchEfiVariables = true;
boot.resumeDevice = "/dev/mapper/cryptroot";
systemd.sleep.extraConfig = ''
HibernateMode=shutdown
'';
hardware = {
cpu.intel.updateMicrocode = true;
@ -33,18 +38,47 @@ in
services.unbound = import ./unbound.nix;
# Radeon driver seems to work better than amdgpu with Radeon R9 M370X
services.xserver.videoDrivers = [ "radeon" ];
# Disable dedicated GPU, use integrated Intel GPU to save battery
# Set default brightness to 50%
# https://ubuntuforums.org/showthread.php?t=2409856
services.cron.systemCronJobs = [
"@reboot root ${pkgs.util-linux}/bin/rfkill block bluetooth"
"@reboot root ${pkgs.coreutils}/bin/echo OFF > /sys/kernel/debug/vgaswitcheroo/switch"
"@reboot root ${pkgs.coreutils}/bin/echo 510 > /sys/class/backlight/gmux_backlight/brightness"
];
# Increase console font size for HiDPI display
console = {
earlySetup = true;
font = lib.mkForce "ter-i32b";
packages = [ pkgs.terminus_font ];
};
# Thunderbolt tools
services.hardware.bolt.enable = true;
powerManagement = {
# Use new schedutil govenor
# https://github.com/NixOS/nixpkgs/pull/42330
# https://www.kernel.org/doc/html/v5.10/admin-guide/pm/cpufreq.html#schedutil
cpuFreqGovernor = lib.mkDefault "schedutil";
# brcmfmac being loaded during hibernation would inhibit a successful resume
# https://bugzilla.kernel.org/show_bug.cgi?id=101681#c116.
# Also brcmfmac could randomly crash on resume from sleep.
powerUpCommands = lib.mkBefore "${pkgs.kmod}/bin/modprobe brcmfmac";
powerDownCommands = lib.mkBefore "${pkgs.kmod}/bin/rmmod brcmfmac";
};
# change lid switch behaviour
#services.logind.lidSwitch = "hibernate";
# TLP for power management
services.tlp = {
enable = true;
settings = {
CPU_SCALING_GOVERNOR_ON_AC = "performance";
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
CPU_SCALING_GOVERNOR_ON_BAT = "schedutil";
CPU_BOOST_ON_AC = 1;
CPU_BOOST_ON_BAT = 0;
};
@ -53,8 +87,9 @@ in
services.udev.extraRules =
# Disable XHC1 wakeup signal to avoid resume getting triggered some time
# after suspend. Reboot required for this to take effect.
''SUBSYSTEM=="pci", KERNEL=="0000:00:14.0", ATTR{power/wakeup}="disabled"'';
lib.optionalString
(lib.versionAtLeast config.boot.kernelPackages.kernel.version "3.13")
''SUBSYSTEM=="pci", KERNEL=="0000:00:14.0", ATTR{power/wakeup}="disabled"'';
services.printing.enable = true;
services.printing.drivers = [ pkgs.brlaser ];
@ -76,9 +111,12 @@ in
# WLAN frequency compliance (e.g. check for radar with DFS)
#
# Radeon driver seems to work better than amdgpu with Radeon R9 M370X
hardware.firmware = with pkgs; [ wireless-regdb ];
boot.extraModprobeConfig = ''
options cfg80211 ieee80211_regdom="DE"
blacklist amdgpu
'';
# This value determines the NixOS release from which the default

View file

@ -29,10 +29,13 @@
fsType = "vfat";
};
swapDevices =
[{ device = "/dev/disk/by-uuid/02fa042f-7310-4be6-a615-524d5d7dc909"; }];
swapDevices = [
{
device = "/swapfile";
size = 18432;
}
];
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
# high-resolution display
hardware.video.hidpi.enable = lib.mkDefault true;
}

View file

@ -13,6 +13,8 @@
"10.0.1.202" = [ "cn02.lev-1" ];
"10.0.1.203" = [ "cn03.lev-1" ];
"10.0.1.204" = [ "cn04.lev-1" ];
"10.0.1.205" = [ "cn05.lev-1" ];
"10.0.1.206" = [ "cn00.lev-1" ];
};
wireguard.enable = true;

View file

@ -19,7 +19,7 @@
# fritz.box stub zone
stub-zone = {
name = "fritz.box";
stub-addr = "192.168.178.1";
stub-addr = "192.168.13.1";
};
# DNS over DLS forwarding