From e4ce746d5b21ee068152754ae7e71201ca48890d Mon Sep 17 00:00:00 2001 From: Bryan Honof Date: Wed, 26 May 2021 18:54:50 +0200 Subject: [PATCH 1/4] Add check for power-profiles-daemon.enable Gnome 40 now uses power-profile-daemon https://gitlab.freedesktop.org/hadess/power-profiles-daemon , which clashes with tlp. This check will disable tlp whenever it finds that the power-profiles-daemon is activated. --- common/pc/laptop/default.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/common/pc/laptop/default.nix b/common/pc/laptop/default.nix index 946d066..b1e91ad 100644 --- a/common/pc/laptop/default.nix +++ b/common/pc/laptop/default.nix @@ -3,5 +3,12 @@ { imports = [ ../. ]; - services.tlp.enable = lib.mkDefault true; + # Gnome 40 introduced a new way of managing power, without tlp. + # However, these 2 services clash when enabled simultaneously. + # https://github.com/NixOS/nixos-hardware/issues/260 + services.tlp.enable = + if config.services.power-profiles-daemon.enable == true then + false + else + true; } From 2bc26b3c5c571b3609e3a50f35e67419c7688085 Mon Sep 17 00:00:00 2001 From: Bryan Honof Date: Wed, 26 May 2021 19:00:01 +0200 Subject: [PATCH 2/4] Add lib.mkDefault to the statement --- common/pc/laptop/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/pc/laptop/default.nix b/common/pc/laptop/default.nix index b1e91ad..87bdca4 100644 --- a/common/pc/laptop/default.nix +++ b/common/pc/laptop/default.nix @@ -6,9 +6,9 @@ # Gnome 40 introduced a new way of managing power, without tlp. # However, these 2 services clash when enabled simultaneously. # https://github.com/NixOS/nixos-hardware/issues/260 - services.tlp.enable = - if config.services.power-profiles-daemon.enable == true then + services.tlp.enable = lib.mkDefault + (if config.services.power-profiles-daemon.enable == true then false else - true; + true); } From 1fe5b7686d83ab6fc3af7304332ee69940300999 Mon Sep 17 00:00:00 2001 From: Bryan Honof Date: Thu, 27 May 2021 00:15:49 +0200 Subject: [PATCH 3/4] Update common/pc/laptop/default.nix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jörg Thalheim --- common/pc/laptop/default.nix | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/common/pc/laptop/default.nix b/common/pc/laptop/default.nix index 87bdca4..0117956 100644 --- a/common/pc/laptop/default.nix +++ b/common/pc/laptop/default.nix @@ -6,9 +6,5 @@ # Gnome 40 introduced a new way of managing power, without tlp. # However, these 2 services clash when enabled simultaneously. # https://github.com/NixOS/nixos-hardware/issues/260 - services.tlp.enable = lib.mkDefault - (if config.services.power-profiles-daemon.enable == true then - false - else - true); + services.tlp.enable = lib.mkDefault !config.services.power-profiles-daemon.enable; } From ca33f586e7aed0cfab8c071c5f3359b8aaf043fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sat, 29 May 2021 10:19:00 +0200 Subject: [PATCH 4/4] fix evaluation --- common/pc/laptop/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/pc/laptop/default.nix b/common/pc/laptop/default.nix index 0117956..309e999 100644 --- a/common/pc/laptop/default.nix +++ b/common/pc/laptop/default.nix @@ -6,5 +6,5 @@ # Gnome 40 introduced a new way of managing power, without tlp. # However, these 2 services clash when enabled simultaneously. # https://github.com/NixOS/nixos-hardware/issues/260 - services.tlp.enable = lib.mkDefault !config.services.power-profiles-daemon.enable; + services.tlp.enable = lib.mkDefault (!config.services.power-profiles-daemon.enable); }