From 363e7678c673147d79f0d0ee2e6534b4d4a3c544 Mon Sep 17 00:00:00 2001 From: Erwin Boskma Date: Tue, 31 Jan 2023 17:13:02 +0100 Subject: [PATCH] Powermanagement tweaking --- machines/loki/configuration.nix | 16 ++++++++++------ machines/loki/hardware-configuration.nix | 17 +++++++---------- modules/base/default.nix | 3 +++ users/erwin/default.nix | 3 ++- users/erwin/home.nix | 2 ++ 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/machines/loki/configuration.nix b/machines/loki/configuration.nix index 0ebf66f..5d8f384 100644 --- a/machines/loki/configuration.nix +++ b/machines/loki/configuration.nix @@ -25,7 +25,7 @@ base = { plymouth.enable = true; work = false; - kernel = pkgs.linuxKernel.packages.linux_6_0; + kernel = pkgs.linuxKernel.packages.linux_6_1; udev-rules = { qmk = true; solo2 = true; @@ -262,6 +262,7 @@ programs.ssh.startAgent = true; services.envfs.enable = true; + services.cpupower-gui.enable = true; services.sunshine = { enable = true; @@ -269,11 +270,14 @@ openFirewall = true; }; - powerManagement.powerUpCommands = '' - ${pkgs.powertop}/bin/powertop --auto-tune - ${pkgs.coreutils}/bin/echo 'on' > /sys/bus/usb/devices/5-4.2/power/control # Logitech G502 HERO SE - ${pkgs.coreutils}/bin/echo 'on' > /sys/bus/usb/devices/5-4.1/power/control # splitkb Kyria rev1 - ''; + powerManagement = { + powerUpCommands = '' + ${pkgs.powertop}/bin/powertop --auto-tune + ${pkgs.coreutils}/bin/echo 'on' > /sys/bus/usb/devices/5-4.2/power/control # Logitech G502 HERO SE + ${pkgs.coreutils}/bin/echo 'on' > /sys/bus/usb/devices/5-4.1/power/control # splitkb Kyria rev1 + ''; + cpuFreqGovernor = "ondemand"; + }; services.nfs.server = { enable = true; diff --git a/machines/loki/hardware-configuration.nix b/machines/loki/hardware-configuration.nix index 287cad6..93639fa 100644 --- a/machines/loki/hardware-configuration.nix +++ b/machines/loki/hardware-configuration.nix @@ -1,16 +1,10 @@ -{ config -, lib -, ... -}: { +{ config, lib, ... }: { boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" "apple-mfi-fastcharge" "zenpower" "nf_nat_ftp" ]; + boot.kernelParams = [ "amd_pstate.shared_mem=1" ]; boot.extraModulePackages = [ ] ++ - (with config.boot.kernelPackages; [ rtl88x2bu zenpower ]); - - boot.extraModprobeConfig = '' - options amd-pstate shared_mem=true - ''; + (with config.boot.kernelPackages; [ rtl88x2bu zenpower cpupower ]); fileSystems."/" = { device = "/dev/disk/by-uuid/42065c7e-d0aa-4de8-a913-014cf59d48ac"; @@ -32,6 +26,9 @@ # high-resolution display hardware.video.hidpi.enable = lib.mkDefault true; - # Enable firmware + # Enable firmware hardware.enableAllFirmware = true; + + # i2c support + hardware.i2c.enable = true; } diff --git a/modules/base/default.nix b/modules/base/default.nix index f2eb512..80fe6f2 100644 --- a/modules/base/default.nix +++ b/modules/base/default.nix @@ -73,6 +73,7 @@ in environment.systemPackages = with pkgs; [ clinfo + config.boot.kernelPackages.cpupower dig du-dust file @@ -82,6 +83,8 @@ in moreutils nix-template nvd + s-tui + stress usbutils xh zip diff --git a/users/erwin/default.nix b/users/erwin/default.nix index c6a0a32..c38ec6c 100644 --- a/users/erwin/default.nix +++ b/users/erwin/default.nix @@ -25,7 +25,8 @@ in users.users.erwin = { isNormalUser = true; home = "/home/erwin"; - extraGroups = [ "wheel" "adm" "audio" "video" "dialout" "input" ]; + extraGroups = [ "wheel" "adm" "audio" "video" "dialout" "input" ] + ++ (optional config.hardware.i2c.enable config.hardware.i2c.group); shell = pkgs.fish; openssh.authorizedKeys.keyFiles = [ (pkgs.fetchurl { diff --git a/users/erwin/home.nix b/users/erwin/home.nix index 3b931d3..41e50de 100644 --- a/users/erwin/home.nix +++ b/users/erwin/home.nix @@ -238,6 +238,8 @@ in programs.steam.enable = true; programs.bandwhich.enable = true; + services.ddccontrol.enable = true; + programs.wireshark = { enable = true; package = pkgs.wireshark;