From 44675f51d5a788d5d3417b9c61aaf94e9e654289 Mon Sep 17 00:00:00 2001 From: Alexander Bantyev Date: Wed, 9 Jun 2021 20:51:38 +0300 Subject: [PATCH] Remove unneeded power module --- modules/default.nix | 1 - modules/power.nix | 47 -------------------------------------------- profiles/desktop.nix | 1 - 3 files changed, 49 deletions(-) delete mode 100644 modules/power.nix diff --git a/modules/default.nix b/modules/default.nix index 539313e..9ef8202 100755 --- a/modules/default.nix +++ b/modules/default.nix @@ -24,7 +24,6 @@ builtins.listToAttrs (builtins.map (path: { ./nix.nix ./overlay.nix ./persist.nix - ./power.nix ./secrets-envsubst.nix ./secrets.nix ./security.nix diff --git a/modules/power.nix b/modules/power.nix deleted file mode 100644 index d5141d9..0000000 --- a/modules/power.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ config, pkgs, lib, ... }: - -with rec { - inherit (config) device devices deviceSpecific; -}; -with deviceSpecific; { - services.udev.extraRules = if isLaptop then - '' - ACTION=="add|change", KERNEL=="sd*[!0-9]|sr*", ATTR{queue/scheduler}="bfq" - ACTION=="change", SUBSYSTEM=="power_supply", ATTR{online}=="0", RUN+="${ - pkgs.systemd - }/bin/systemctl start battery" - ACTION=="change", SUBSYSTEM=="power_supply", ATTR{online}=="1", RUN+="${ - pkgs.systemd - }/bin/systemctl start ac" - ACTION=="add|change", SUBSYSTEM=="backlight", MODE:="0777" - '' + (if device == "ASUS-Laptop" then '' - ACTION=="add|change", SUBSYSTEM=="net", KERNEL=="wlan*" RUN+="${ - pkgs.iw - }/bin/iw dev %k set power_save off" - '' else - "") - else - ""; - systemd.services.battery = { - enable = isLaptop; - description = "Executes commands needed on battery power"; - script = '' - ${ - pkgs.linuxPackages_latest.cpupower - }/bin/cpupower frequency-set -g powersave - ${pkgs.hdparm}/bin/hdparm -B 1 /dev/sda - echo "500" > /sys/class/backlight/*/brightness - ''; - }; - systemd.services.ac = { - enable = isLaptop; - description = "Executes commands needed on ac power"; - script = '' - ${ - pkgs.linuxPackages_latest.cpupower - }/bin/cpupower frequency-set -g performance - ${pkgs.hdparm}/bin/hdparm -B 255 /dev/sda - echo "900" > /sys/class/backlight/*/brightness - ''; - }; -} diff --git a/profiles/desktop.nix b/profiles/desktop.nix index 930ec33..01645c9 100644 --- a/profiles/desktop.nix +++ b/profiles/desktop.nix @@ -5,7 +5,6 @@ applications ezwg hardware - power themes virtualisation