Add laptop module
This commit is contained in:
parent
2888303bb0
commit
559a477e05
5 changed files with 49 additions and 13 deletions
47
modules/nixos/hardware/laptop/default.nix
Normal file
47
modules/nixos/hardware/laptop/default.nix
Normal file
|
@ -0,0 +1,47 @@
|
|||
{ lib, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.hardware.laptop;
|
||||
in
|
||||
{
|
||||
options.modules.hardware.laptop = {
|
||||
enable = mkEnableOption "Install Laptop utils";
|
||||
|
||||
governor_battery = mkOption {
|
||||
type = types.str;
|
||||
default = "powersave";
|
||||
};
|
||||
turbo_battery = mkOption {
|
||||
type = types.enum ["always" "never" "auto"];
|
||||
default = "never";
|
||||
};
|
||||
governor_ac = mkOption {
|
||||
type = types.str;
|
||||
default = "schedutil";
|
||||
};
|
||||
turbo_ac = mkOption {
|
||||
type = types.enum ["always" "never" "auto"];
|
||||
default = "never";
|
||||
};
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
# Wifi is installed on laptops
|
||||
networking.wireless.iwd.enable = true;
|
||||
|
||||
# And cpufreq
|
||||
services.auto-cpufreq = {
|
||||
enable = true;
|
||||
settings = {
|
||||
battery = {
|
||||
governor = cfg.governor_battery;
|
||||
turbo = cfg.turbo_battery;
|
||||
};
|
||||
charger = {
|
||||
governor = cfg.governor_ac;
|
||||
turbo = cfg.turbo_ac;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue