feat: adds laptop config but working this time

This commit is contained in:
Ahwx 2024-10-21 22:57:49 +02:00
parent e8d7bcda16
commit fb5de18e32

View file

@ -1,45 +1,121 @@
{ config, pkgs, lib, ... }:
{
options = {
liv.laptop = lib.mkOption {
default = false;
type = lib.types.boolean;
description = ''
Enable this if the host is a laptop, to enable power management, extra packages, kernel modules, etc.
'';
{ lib, pkgs, config, username, home-manager, ... }:
with lib;
let
cfg = config.liv.laptop;
in {
options.liv.laptop = {
enable = mkEnableOption "Enable laptop";
};
config = mkIf cfg.enable {
home-manager = {
users.${username} = {
home.packages = with pkgs; [
# reader
vlc
acpi
brightnessctl
];
};
};
config = lib.mkIf config.liv.laptop {
networking.networkmanager.enable = true;
environment.systemPackages = with pkgs; [
acpi
brightnessctl
cpupower-gui
powertop
];
auto-cpufreq = {
enable = false;
settings = {
battery = {
governor = "powersave";
turbo = "auto";
};
charger = {
governor = "performance";
turbo = "auto";
};
};
};
boot = {
kernelModules = ["acpi_call"];
extraModulePackages = with config.boot.kernelPackages;
[
acpi_call
cpupower
]
++ [pkgs.cpupower-gui];
];
};
services = {
# thermald.enable = true; # Enable if on Intel, should be a if-statement.
# power-profiles-daemon.enable = mkDefault true;
upower = {
enable = true;
percentageLow = 20;
percentageCritical = 10;
percentageAction = 5;
criticalPowerAction = "Hibernate";
};
};
# powerManagement.powertop.enable = true;
};
}
# { config, pkgs, lib, ... }:
# with lib;
# let
# cfg = config.liv.profiles;
# laptopPkgs = with pkgs; [
# acpi
# brightnessctl
# ];
# in
# {
# options = {
# liv-laptop = lib.mkOption {
# default = false;
# type = lib.types.bool;
# description = ''
# Enable this if the host is a laptop, to enable power management, extra packages, kernel modules, etc.
# '';
# };
# };
#
# config = lib.mkIf cfg.liv-laptop {
# home.packages = with pkgs; [
# # reader
# vlc
# ] ++ optionals cfg.liv-laptop laptopPkgs;
#
#
# networking.networkmanager.enable = true;
#
# environment.systemPackages = with pkgs; [
# cpupower-gui
# powertop
# ];
# # auto-cpufreq = {
# # enable = false;
# # settings = {
# # battery = {
# # governor = "powersave";
# # turbo = "auto";
# # };
# # charger = {
# # governor = "performance";
# # turbo = "auto";
# # };
# # };
# # };
# boot = {
# kernelModules = ["acpi_call"];
# extraModulePackages = with config.boot.kernelPackages;
# [
# acpi_call
# cpupower
# ]
# ++ [pkgs.cpupower-gui];
# };
# services = {
# thermald.enable = true;
# cpupower-gui.enable = true;
# # power-profiles-daemon.enable = true;
#
# upower = {
# enable = true;
# percentageLow = 20;
# percentageCritical = 5;
# percentageAction = 3;
# criticalPowerAction = "PowerOff";
# };
# };
# };
# }