This commit is contained in:
2026-02-14 18:23:59 +00:00
parent b99ccfc588
commit 5a8bd09491
11 changed files with 504 additions and 2 deletions

View File

@@ -8,6 +8,7 @@
{
home.packages = [
pkgs.hyprcursor
pkgs.wlogout
];
home.pointerCursor = {
enable = true;
@@ -100,7 +101,7 @@
bind = [
"$mainMod, C, killactive"
"$mainMod, M, exec, uwsm stop"
"$mainMod, E, exec, $fileManager"
"$mainMod, E, exec, zen"
"$mainMod, Q, exec, kitty"
"$mainMod, V, togglefloating,"
"$mainMod, P, pseudo, # dwindle"

View File

@@ -0,0 +1,19 @@
{ den, modules, ... }:
{
modules.auto-cpufreq = {
nixos =
{ ... }:
{
services.auto-cpufreq.settings = {
battery = {
governor = "powersave";
turbo = "never";
};
charger = {
governor = "performance";
turbo = "auto";
};
};
};
};
}

View File

@@ -0,0 +1,13 @@
{ den, modules, ... }:
{
modules.battery-ac-targets = {
nixos =
{ ... }:
{
services.udev.extraRules = ''
SUBSYSTEM=="power_supply",ENV{POWER_SUPPLY_ONLINE}=="0", RUN+="/run/current-system/systemd/bin/systemctl start battery.target"
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", RUN+="/run/current-system/systemd/bin/systemctl start ac.target"
'';
};
};
}

View File

@@ -0,0 +1,13 @@
{ den, modules, ... }:
{
modules.common.provides = {
laptop-power-management = {
includes = [
modules.auto-cpufreq
modules.battery-ac-targets
modules.intel-mgm
modules.tlp
];
};
};
}

View File

@@ -0,0 +1,46 @@
{ den, modules, ... }:
{
# Intel Mobile Gpu Management
modules.intel-mgm = {
nixos =
{ pkgs, ... }:
let
batt-gpu = pkgs.writeShellScript "batt-igpu" ''
${pkgs.intel-gpu-tools}/bin/intel_gpu_frequency -e
echo "800" > /sys/class/drm/card1/gt_boost_freq_mhz
'';
ac-gpu = pkgs.writeShellScript "ac-igpu" ''
${pkgs.intel-gpu-tools}/bin/intel_gpu_frequency -d
echo "2350" > /sys/class/drm/card1/gt_boost_freq_mhz
'';
in
{
systemd.services.gpu-limit-on-batt = {
enable = true;
description = "Using rfkill; disable all rf devices before sleeping.";
before = [ "battery.target" ];
serviceConfig = {
Type = "oneshot";
ExecStart = "${batt-gpu}";
RemainAfterExit = true;
};
wantedBy = [ "battery.target" ];
partOf = [ "battery.target" ];
};
systemd.services.gpu-limit-on-ac = {
enable = true;
description = "Using rfkill; disable all rf devices before sleeping.";
before = [ "ac.target" ];
serviceConfig = {
Type = "oneshot";
ExecStart = "${ac-gpu}";
RemainAfterExit = true;
};
wantedBy = [ "ac.target" ];
partOf = [ "ac.target" ];
};
};
};
}

View File

@@ -0,0 +1,45 @@
{ den, modules, ... }:
{
modules.tlp = {
homeManager = { };
nixos = {
services.tlp = {
enable = true;
settings = {
# Wireless power saving
WIFI_PWR_ON_BAT = "1";
# USB autosuspend
USB_AUTOSUSPEND = "1";
# SATA drive power management
SATA_LINKPWR_ON_BAT = "min_power";
# PCI Express Active-State Power Management (ASPM)
PCIE_ASPM_ON_BAT = "powersupersave";
RUNTIME_PM_ON_AC = "auto";
RUNTIME_PM_ON_BAT = "auto";
# Disable Bluetooth on battery
# DEVICES_TO_DISABLE_ON_BAT = "bluetooth";
# Restore brightness on battery
RESTORE_BRIGHTNESS_ON_BAT = "1";
PCIE_ASPM_ON_AC = "balanced";
DEVICES_TO_DISABLE_ON_BAT_NOT_IN_USE = "bluetooth";
INTEL_GPU_MAX_FREQ_ON_AC = 0;
INTEL_GPU_MAX_FREQ_ON_BAT = 800;
INTEL_GPU_BOOST_FREQ_ON_AC = 0;
INTEL_GPU_BOOST_FREQ_ON_BAT = 800;
CPU_MAX_PERF_ON_BAT = 50;
PLATFORM_PROFILE_ON_AC = "balanced";
PLATFORM_PROFILE_ON_BAT = "quiet";
STOP_CHARGE_THRESH_BAT0 = 80;
};
};
};
};
}

42
config/modules/stylix.nix Normal file
View File

@@ -0,0 +1,42 @@
{
den,
modules,
inputs,
...
}:
{
flake-file.inputs = {
stylix = {
url = "github:nix-community/stylix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
modules.stylix = {
homeManager =
{ pkgs, ... }:
{
imports = [ inputs.stylix.homeModules.stylix ];
stylix = {
enable = true;
autoEnable = false;
targets.gtk.enable = true;
targets.qt.enable = true;
targets.tmux.enable = false;
fonts = {
monospace = {
name = "CaskaydiaCove Nerd Font Mono";
package = pkgs.nerd-fonts.caskaydia-cove;
};
};
base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml";
};
};
nixos =
{ ... }:
{
imports = [ inputs.stylix.nixosModules.stylix ];
stylix.enable = true;
stylix.autoEnable = false;
};
};
}