acpid: fix cpupower
authorJulien Moutinho <julm+julm-nix@sourcephile.fr>
Sun, 21 Aug 2022 07:59:02 +0000 (09:59 +0200)
committerJulien Moutinho <julm+julm-nix@sourcephile.fr>
Sun, 21 Aug 2022 07:59:02 +0000 (09:59 +0200)
nixos/profiles/acpid.nix

index ee3f70188544b7a85af7b6e63ed9dd7d3d90b42a..488a1f4529bc6f9eecae4cb3ca974b29171c92c1 100644 (file)
@@ -2,16 +2,10 @@
 {
 hardware.acpilight.enable = true;
 boot.kernelModules = [ "msr" "acpi_cpufreq" ];
-system.activationScripts.acPlug = {
-  deps = [ "modprobe" ];
-  text = ''
-    PATH="${pkgs.kmod}/bin:$PATH"
-    modprobe msr
-    modprobe acpi_cpufreq
-    ${pkgs.acpi}/bin/acpi -a | grep -q 'Adapter .*: on-line' ||
-    ${pkgs.linuxPackages.cpupower}/bin/cpupower frequency-set -g powersave
-  '';
-};
+systemd.services.acpid.postStart = ''
+  ${pkgs.acpi}/bin/acpi -a | grep -q 'Adapter .*: on-line' ||
+  ${pkgs.linuxPackages.cpupower}/bin/cpupower frequency-set -g powersave
+'';
 services.acpid = {
   enable = true;
   handlers = {