feat: nb performance tweaks

This commit is contained in:
2025-10-15 11:25:46 +02:00
parent a05c33ad87
commit df6465fa8a
4 changed files with 42 additions and 26 deletions

View File

@@ -77,9 +77,17 @@ in {
swapDevices = [ { swapDevices = [ {
device = "/nix/persist/swapfile"; device = "/nix/persist/swapfile";
size = 32 * 1024; # Size is in megabytes size = 32 * 1024; # Size is in megabytes (for hibernation)
} ]; } ];
# Memory tuning for 92GB RAM
boot.kernel.sysctl = {
"vm.swappiness" = 10;
"vm.dirty_ratio" = 10;
"vm.dirty_background_ratio" = 5;
"vm.vfs_cache_pressure" = 50;
};
# nixos cross building qemu # nixos cross building qemu
boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
boot.supportedFilesystems = [ "ntfs" ]; boot.supportedFilesystems = [ "ntfs" ];
@@ -100,18 +108,6 @@ in {
General = { ControllerMode = "bredr"; }; General = { ControllerMode = "bredr"; };
}; };
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";
START_CHARGE_THRESH_BAT0 = 60;
STOP_CHARGE_THRESH_BAT0 = 80;
};
};
environment.persistence."/nix/persist" = { environment.persistence."/nix/persist" = {
hideMounts = true; hideMounts = true;
directories = [ directories = [
@@ -263,13 +259,16 @@ in {
}; };
nix = { nix = {
settings.auto-optimise-store = true; settings = {
settings.experimental-features = [ "nix-command" "flakes" ]; auto-optimise-store = true;
# autoOptimiseStore = true; experimental-features = [ "nix-command" "flakes" ];
max-jobs = 12;
cores = 2;
};
gc = { gc = {
automatic = true; automatic = true;
dates = "daily"; dates = "weekly";
options = "--delete-older-than 30d"; options = "--delete-older-than 14d";
}; };
# Free up to 1GiB whenever there is less than 100MiB left. # Free up to 1GiB whenever there is less than 100MiB left.
extraOptions = '' extraOptions = ''

View File

@@ -17,6 +17,15 @@
boot.kernelModules = [ "amdgpu" ]; boot.kernelModules = [ "amdgpu" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
# AMD Ryzen 7 7840U optimizations
boot.kernelParams = [
"amd_pstate=active"
"amdgpu.dcdebugmask=0x10"
"amdgpu.dc=1"
"snd_hda_intel.power_save=1"
"transparent_hugepage=madvise"
];
fileSystems."/" = { fileSystems."/" = {
device = "none"; device = "none";
fsType = "tmpfs"; fsType = "tmpfs";
@@ -38,9 +47,10 @@
options = [ options = [
"subvol=@" "subvol=@"
"ssd" "ssd"
"compress=zstd:3" "compress=zstd:1"
"discard=async" "discard=async"
"noatime" "noatime"
"commit=120"
]; ];
}; };
@@ -51,9 +61,10 @@
options = [ options = [
"subvol=@nix-store" "subvol=@nix-store"
"ssd" "ssd"
"compress=zstd:3" "compress=zstd:1"
"discard=async" "discard=async"
"noatime" "noatime"
"commit=120"
]; ];
}; };
@@ -64,9 +75,10 @@
options = [ options = [
"subvol=@nix-persist" "subvol=@nix-persist"
"ssd" "ssd"
"compress=zstd:3" "compress=zstd:1"
"discard=async" "discard=async"
"noatime" "noatime"
"commit=120"
]; ];
}; };
@@ -79,13 +91,11 @@
networking.useDHCP = lib.mkDefault true; networking.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp52s0.useDHCP = lib.mkDefault true; # networking.interfaces.wlp52s0.useDHCP = lib.mkDefault true;
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
hardware.graphics = { hardware.graphics = {
enable = true; enable = true;
extraPackages = with pkgs; [ extraPackages = with pkgs; [
amdvlk
vaapiVdpau vaapiVdpau
libvdpau-va-gl libvdpau-va-gl
libva libva

View File

@@ -110,8 +110,6 @@ in {
programs.light.enable = true; programs.light.enable = true;
hardware.graphics.extraPackages = [ pkgs.amdvlk ];
hardware.bluetooth.enable = true; hardware.bluetooth.enable = true;
hardware.bluetooth.powerOnBoot = true; hardware.bluetooth.powerOnBoot = true;
hardware.bluetooth.settings = { hardware.bluetooth.settings = {
@@ -123,8 +121,16 @@ in {
services.tlp.settings = { services.tlp.settings = {
CPU_SCALING_GOVERNOR_ON_AC = "performance"; CPU_SCALING_GOVERNOR_ON_AC = "performance";
CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
CPU_ENERGY_PERF_POLICY_ON_BAT = "balance_power";
CPU_BOOST_ON_AC = 1;
CPU_BOOST_ON_BAT = 0;
RUNTIME_PM_ON_AC = "auto";
RUNTIME_PM_ON_BAT = "auto";
START_CHARGE_THRESH_BAT0 = 60; START_CHARGE_THRESH_BAT0 = 60;
STOP_CHARGE_THRESH_BAT0 = 80; STOP_CHARGE_THRESH_BAT0 = 80;
}; };

View File

@@ -6,6 +6,7 @@
host = "127.0.0.1"; host = "127.0.0.1";
port = 11434; port = 11434;
openFirewall = false; openFirewall = false;
acceleration = "rocm";
loadModels = [ loadModels = [
"mxbai-embed-large" "mxbai-embed-large"
]; ];