From 2188b7595b62a63a5a9840014859f6cc315b910b Mon Sep 17 00:00:00 2001 From: Artemis Tosini Date: Wed, 22 Nov 2023 18:31:51 +0000 Subject: [PATCH] Try to improve battery life on rainbowdash --- flake.lock | 36 +++++++++++++++++----------------- sets/laptop.nix | 5 +---- sets/wifi.nix | 1 + sets/workstation.nix | 1 - system/rainbowdash/default.nix | 24 ++++++++++++++++++++++- 5 files changed, 43 insertions(+), 24 deletions(-) diff --git a/flake.lock b/flake.lock index 8eb20c4..4a8920f 100644 --- a/flake.lock +++ b/flake.lock @@ -201,11 +201,11 @@ ] }, "locked": { - "lastModified": 1700261686, - "narHash": "sha256-kplQg6hKFNuWKrOyGp9D//G/WH1nHGJ43r2m7fagTYY=", + "lastModified": 1700553346, + "narHash": "sha256-kW7uWsCv/lxuA824Ng6EYD9hlVYRyjuFn0xBbYltAeQ=", "owner": "nix-community", "repo": "home-manager", - "rev": "ecd0a800f716b80a6eac58a7ac34d6d33e6fa5ee", + "rev": "1aabb0a31b25ad83cfaa37c3fe29053417cd9a0f", "type": "github" }, "original": { @@ -250,11 +250,11 @@ ] }, "locked": { - "lastModified": 1699760693, - "narHash": "sha256-u/gkNUHQR/q23voqE5J4xmEWQIAqR+g3lUnCtzn0k7Y=", + "lastModified": 1700363379, + "narHash": "sha256-fBEVPFwSZ6AmBE1s1oT7E9WVuqRghruxTnSQ8UUlMkw=", "owner": "nix-community", "repo": "nix-index-database", - "rev": "8aff4ca3dee60d1422489fe8d52c2f837b3ad113", + "rev": "27920146e671a0d565aaa7452907383be14d8d82", "type": "github" }, "original": { @@ -265,11 +265,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1700315735, - "narHash": "sha256-zlSLW6dX5XwBEwN87CIVtMr8zDSKvTRFmWmIQ9FfWgo=", + "lastModified": 1700559156, + "narHash": "sha256-gL4epO/qf+wo30JjC3g+b5Bs8UrpxzkhNBBsUYxpw2g=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "1721da31f9b30cbf4460c4ec5068b3b6174a4694", + "rev": "c3abafb01cd7045dba522af29b625bd1e170c2fb", "type": "github" }, "original": { @@ -280,11 +280,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1700204040, - "narHash": "sha256-xSVcS5HBYnD3LTer7Y2K8ZQCDCXMa3QUD1MzRjHzuhI=", + "lastModified": 1700390070, + "narHash": "sha256-de9KYi8rSJpqvBfNwscWdalIJXPo8NjdIZcEJum1mH0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "c757e9bd77b16ca2e03c89bf8bc9ecb28e0c06ad", + "rev": "e4ad989506ec7d71f7302cc3067abd82730a4beb", "type": "github" }, "original": { @@ -338,11 +338,11 @@ "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1700240304, - "narHash": "sha256-nR5Ot2nN0msfGD1Vj76/4zb6+5ksJ28gfsit/BhK/oA=", + "lastModified": 1700659845, + "narHash": "sha256-nU3fHWd/YKPtnJ+PVqtooVNlFtkSQIfrsq14wyufUXA=", "owner": "nix-community", "repo": "nixvim", - "rev": "440c449c0a13f7864bb8406baf19f4e9f61abc55", + "rev": "796e7391cec5134fd36951d275e7a0809e2107c8", "type": "github" }, "original": { @@ -390,11 +390,11 @@ "nixpkgs-stable": "nixpkgs-stable_2" }, "locked": { - "lastModified": 1699271226, - "narHash": "sha256-8Jt1KW3xTjolD6c6OjJm9USx/jmL+VVmbooADCkdDfU=", + "lastModified": 1700064067, + "narHash": "sha256-1ZWNDzhu8UlVCK7+DUN9dVQfiHX1bv6OQP9VxstY/gs=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "ea758da1a6dcde6dc36db348ed690d09b9864128", + "rev": "e558068cba67b23b4fbc5537173dbb43748a17e8", "type": "github" }, "original": { diff --git a/sets/laptop.nix b/sets/laptop.nix index 446de28..03964bc 100644 --- a/sets/laptop.nix +++ b/sets/laptop.nix @@ -3,10 +3,7 @@ { imports = [ ./wifi.nix ]; - services = { - tlp.enable = true; - upower.enable = true; - }; + services.upower.enable = true; programs.light.enable = true; users.users.artemis.extraGroups = [ "video" ]; diff --git a/sets/wifi.nix b/sets/wifi.nix index 80ae83f..497abe7 100644 --- a/sets/wifi.nix +++ b/sets/wifi.nix @@ -3,6 +3,7 @@ networking.networkmanager = { enable = true; wifi.macAddress = "stable"; + wifi.backend = "iwd"; }; users.users.artemis.extraGroups = [ "networkmanager" ]; } diff --git a/sets/workstation.nix b/sets/workstation.nix index 1edc7a9..fe2a84b 100644 --- a/sets/workstation.nix +++ b/sets/workstation.nix @@ -31,7 +31,6 @@ nssmdns = true; }; flatpak.enable = true; - fwupd.enable = true; pcscd.enable = true; printing.enable = true; udev.packages = [ (pkgs.callPackage ../externals/rules/uhk.nix { }) ]; diff --git a/system/rainbowdash/default.nix b/system/rainbowdash/default.nix index 141a763..72343b7 100644 --- a/system/rainbowdash/default.nix +++ b/system/rainbowdash/default.nix @@ -13,8 +13,11 @@ ../../sets/virtualization.nix ../../sets/workstation.nix inputs.nixos-hardware.nixosModules.common-cpu-intel + inputs.nixos-hardware.nixosModules.common-gpu-intel inputs.nixos-hardware.nixosModules.common-pc-laptop inputs.nixos-hardware.nixosModules.common-pc-laptop-acpi_call + inputs.nixos-hardware.nixosModules.common-pc-ssd + ]; boot.supportedFilesystems = [ "nfs4" ]; @@ -57,7 +60,26 @@ hardware.opengl.extraPackages = with pkgs; [ intel-compute-runtime ]; boot.blacklistedKernelModules = [ "psmouse" ]; - services.thermald.enable = true; + hardware.enableRedistributableFirmware = true; + services = { + fwupd.enable = true; + thermald.enable = true; + tlp.enable = true; + tlp.settings = { + CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; + CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; + PLATFORM_PROFILE_ON_AC = "performance"; + PLATFORM_PROFILE_ON_BAT = "low-power"; + CPU_BOOST_ON_AC = 1; + CPU_BOOST_ON_BAT = 0; + RUNTIME_ASPM_ON_AC = "default"; + RUNTIME_ASPM_ON_BAT = "powersave"; + CPU_DRIVER_OPMODE_ON_AC = "passive"; + CPU_DRIVER_OPMODE_ON_BAT = "passive"; + CPU_SCALING_GOVERNOR_ON_AC = "schedutil"; + CPU_SCALING_GOVERNOR_ON_BAT = "schedutil"; + }; + }; networking.domain = "manehattan.artem.ist"; networking.hostName = "rainbowdash";