Actually enforce the roles

This commit is contained in:
ItsDrike 2024-04-13 21:15:25 +02:00
parent 01e3567653
commit dd00ed5f70
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0
9 changed files with 238 additions and 193 deletions

View file

@ -1,66 +1,70 @@
{lib, config, pkgs, ...}: let
inherit (lib) mkDefault;
in{
hardware.acpilight.enable = true;
{ pkgs, lib, config, ...}: let
inherit (lib) mkIf mkDefault;
deviceType = config.myOptions.device.roles.type;
acceptedTypes = ["laptop"];
in {
config = mkIf (builtins.elem deviceType acceptedTypes) {
hardware.acpilight.enable = true;
environment.systemPackages = with pkgs; [
acpi
powertop
];
environment.systemPackages = with pkgs; [
acpi
powertop
];
services = {
# handle ACPI events
acpid.enable = true;
services = {
# handle ACPI events
acpid.enable = true;
# allows changing system behavior based upon user-selected power profiles
power-profiles-daemon.enable = true;
# allows changing system behavior based upon user-selected power profiles
power-profiles-daemon.enable = true;
# temperature target on battery
undervolt = {
tempBat = 65; # deg C
package = pkgs.undervolt;
};
# temperature target on battery
undervolt = {
tempBat = 65; # deg C
package = pkgs.undervolt;
};
# superior power management
auto-cpufreq = {
enable = true;
# superior power management
auto-cpufreq = {
enable = true;
# define the profiles
# (you can manually switch between profiles using `powerprofilesctl` cmd)
settings = let
MHz = x: x * 1000;
in {
battery = {
governor = "powersave";
scaling_min_freq = mkDefault (MHz 1200);
scaling_max_freq = mkDefault (MHz 1800);
turbo = "never";
# define the profiles
# (you can manually switch between profiles using `powerprofilesctl` cmd)
settings = let
MHz = x: x * 1000;
in {
battery = {
governor = "powersave";
scaling_min_freq = mkDefault (MHz 1200);
scaling_max_freq = mkDefault (MHz 1800);
turbo = "never";
};
charger = {
governor = "performance";
scaling_min_freq = mkDefault (MHz 1800);
scaling_max_freq = mkDefault (MHz 3800);
turbo = "auto";
};
};
};
charger = {
governor = "performance";
scaling_min_freq = mkDefault (MHz 1800);
scaling_max_freq = mkDefault (MHz 3800);
turbo = "auto";
};
# DBus service that provides power management support to applications
upower = {
enable = true;
percentageLow = 15;
percentageCritical = 5;
percentageAction = 3;
criticalPowerAction = "Hibernate";
};
};
# DBus service that provides power management support to applications
upower = {
enable = true;
percentageLow = 15;
percentageCritical = 5;
percentageAction = 3;
criticalPowerAction = "Hibernate";
boot = {
kernelModules = ["acpi_call"];
extraModulePackages = with config.boot.kernelPackages; [
acpi_call
cpupower
];
};
};
boot = {
kernelModules = ["acpi_call"];
extraModulePackages = with config.boot.kernelPackages; [
acpi_call
cpupower
];
};
}

View file

@ -1,22 +1,28 @@
{
services.xserver.libinput = {
# enable libinput
enable = true;
{ lib, config, ...}: let
inherit (lib) mkIf;
deviceType = config.myOptions.device.roles.type;
acceptedTypes = ["laptop"];
in {
config = mkIf (builtins.elem deviceType acceptedTypes) {
services.xserver.libinput = {
# enable libinput
enable = true;
# disable mouse acceleration
mouse = {
accelProfile = "flat";
accelSpeed = "0";
middleEmulation = false;
};
# disable mouse acceleration
mouse = {
accelProfile = "flat";
accelSpeed = "0";
middleEmulation = false;
};
# touchpad settings
touchpad = {
naturalScrolling = false; # I'm weird like that
tapping = true;
clickMethod = "clickfinger";
horizontalScrolling = true;
disableWhileTyping = true;
# touchpad settings
touchpad = {
naturalScrolling = false; # I'm weird like that
tapping = true;
clickMethod = "clickfinger";
horizontalScrolling = true;
disableWhileTyping = true;
};
};
};
}