Aloria power management

This commit is contained in:
Thomas Avé 2024-10-06 18:01:46 +02:00
parent 5cc088ac8b
commit 38e4b5b3a7
5 changed files with 65 additions and 18 deletions

View File

@ -23,7 +23,7 @@
}; };
# wayland.windowManager.hyprland.settings.env = ["WLR_DRM_DEVICES,/dev/dri/by-path/pci-0000:01:00.0-card"]; # Nvidia # wayland.windowManager.hyprland.settings.env = ["WLR_DRM_DEVICES,/dev/dri/by-path/pci-0000:01:00.0-card"]; # Nvidia
# wayland.windowManager.hyprland.settings.env = ["WLR_DRM_DEVICES,/dev/dri/by-path/pci-0000:00:02.0-card"]; # Intel wayland.windowManager.hyprland.settings.env = ["WLR_DRM_DEVICES,/dev/dri/by-path/pci-0000:00:02.0-card"]; # Intel
wayland.windowManager.hyprland.settings = { wayland.windowManager.hyprland.settings = {
exec-once = [ exec-once = [
"${pkgs.swaylock-fancy}/bin/swaylock-fancy" "${pkgs.swaylock-fancy}/bin/swaylock-fancy"

View File

@ -8,24 +8,55 @@ in {
(import ../Common/desktop.nix { inherit inputs pkgs config; }) (import ../Common/desktop.nix { inherit inputs pkgs config; })
(import ../Common/nfs.nix { inherit pkgs serverIP; }) (import ../Common/nfs.nix { inherit pkgs serverIP; })
]; ];
programs.nix-ld.enable = true;
hardware.graphics.extraPackages = [ hardware.graphics.extraPackages = [
pkgs.intel-compute-runtime pkgs.intel-compute-runtime
pkgs.intel-media-driver pkgs.intel-media-driver
]; ];
zramSwap.enable = true; zramSwap.enable = true;
services.upower.enable = true;
services.logind.extraConfig = ''HandlePowerKey=ignore''; services.logind.extraConfig = ''HandlePowerKey=ignore'';
# services.ollama = { networking.wireless.iwd.enable = true;
# enable = true; networking.wireless.iwd.settings = {
# }; IPv6 = {
programs.nix-ld.enable = true; Enabled = true;
};
Settings = {
AutoConnect = true;
};
};
# virtualisation
virtualisation.libvirtd.enable = true; virtualisation.libvirtd.enable = true;
virtualisation.libvirtd.qemu.ovmf.enable = true; virtualisation.libvirtd.qemu.ovmf.enable = true;
virtualisation.spiceUSBRedirection.enable = true; virtualisation.spiceUSBRedirection.enable = true;
programs.virt-manager.enable = true; programs.virt-manager.enable = true;
users.users.user.extraGroups = [ "libvirtd" ]; users.users.user.extraGroups = [ "libvirtd" ];
services.tlp = {
enable = true;
settings = {
CPU_SCALING_GOVERNOR_ON_AC = "performance";
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
CPU_MIN_PERF_ON_AC = 0;
CPU_MAX_PERF_ON_AC = 100;
CPU_MIN_PERF_ON_BAT = 0;
CPU_MAX_PERF_ON_BAT = 20;
#Optional helps save long term battery health
START_CHARGE_THRESH_BAT0 = 40; # 40 and bellow it starts to charge
STOP_CHARGE_THRESH_BAT0 = 80; # 80 and above it stops charging
};
};
networking.wg-quick.interfaces = { networking.wg-quick.interfaces = {
Tunnel = { Tunnel = {
address = [ "10.0.0.5/24" "2a02:a03f:83ad:2101::5/128" ]; address = [ "10.0.0.5/24" "2a02:a03f:83ad:2101::5/128" ];
@ -56,16 +87,4 @@ in {
}]; }];
}; };
}; };
# fileSystems."/home/server".device = pkgs.lib.mkForce "10.0.0.1:/home/server";
services.upower.enable = true;
networking.wireless.iwd.enable = true;
networking.wireless.iwd.settings = {
IPv6 = {
Enabled = true;
};
Settings = {
AutoConnect = true;
};
};
} }

View File

@ -14,6 +14,7 @@
boot.kernelPackages = pkgs.linuxPackages_latest; boot.kernelPackages = pkgs.linuxPackages_latest;
boot.tmp.cleanOnBoot = true; boot.tmp.cleanOnBoot = true;
powerManagement.enable = true;
services.thermald.enable = true; services.thermald.enable = true;
services.pcscd.enable = true; services.pcscd.enable = true;
services.fwupd.enable = true; services.fwupd.enable = true;

View File

@ -5,7 +5,6 @@
hardware.graphics = { hardware.graphics = {
enable = true; enable = true;
}; };
services.power-profiles-daemon.enable = true;
services.greetd = { services.greetd = {
enable = true; enable = true;

View File

@ -43,5 +43,33 @@
prime.sync.enable = pkgs.lib.mkForce true; prime.sync.enable = pkgs.lib.mkForce true;
}; };
}; };
disable.configuration = {
system.nixos.tags = [ "disable" ];
hardware.nvidia = {
modesetting.enable = pkgs.lib.mkForce false;
powerManagement.enable = pkgs.lib.mkForce false;
powerManagement.finegrained = pkgs.lib.mkForce false;
open = pkgs.lib.mkForce false;
nvidiaSettings = pkgs.lib.mkForce false;
prime.offload.enable = pkgs.lib.mkForce false;
prime.offload.enableOffloadCmd = pkgs.lib.mkForce false;
};
boot.extraModprobeConfig = ''
blacklist nouveau
options nouveau modeset=0
'';
services.udev.extraRules = ''
# Remove NVIDIA USB xHCI Host Controller devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c0330", ATTR{power/control}="auto", ATTR{remove}="1"
# Remove NVIDIA USB Type-C UCSI devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c8000", ATTR{power/control}="auto", ATTR{remove}="1"
# Remove NVIDIA Audio devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x040300", ATTR{power/control}="auto", ATTR{remove}="1"
# Remove NVIDIA VGA/3D controller devices
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x03[0-9]*", ATTR{power/control}="auto", ATTR{remove}="1"
'';
boot.blacklistedKernelModules = [ "nouveau" "nvidia" "nvidia_drm" "nvidia_modeset" ];
};
}; };
} }