diff --git a/hosts/nb/configuration.nix b/hosts/nb/configuration.nix index 7f54c50..30d3d03 100644 --- a/hosts/nb/configuration.nix +++ b/hosts/nb/configuration.nix @@ -77,9 +77,17 @@ in { swapDevices = [ { 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 boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; boot.supportedFilesystems = [ "ntfs" ]; @@ -100,18 +108,6 @@ in { 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" = { hideMounts = true; directories = [ @@ -263,13 +259,16 @@ in { }; nix = { - settings.auto-optimise-store = true; - settings.experimental-features = [ "nix-command" "flakes" ]; - # autoOptimiseStore = true; + settings = { + auto-optimise-store = true; + experimental-features = [ "nix-command" "flakes" ]; + max-jobs = 12; + cores = 2; + }; gc = { automatic = true; - dates = "daily"; - options = "--delete-older-than 30d"; + dates = "weekly"; + options = "--delete-older-than 14d"; }; # Free up to 1GiB whenever there is less than 100MiB left. extraOptions = '' diff --git a/hosts/nb/hardware-configuration.nix b/hosts/nb/hardware-configuration.nix index abc1edd..dc815b7 100644 --- a/hosts/nb/hardware-configuration.nix +++ b/hosts/nb/hardware-configuration.nix @@ -17,6 +17,15 @@ boot.kernelModules = [ "amdgpu" ]; 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."/" = { device = "none"; fsType = "tmpfs"; @@ -38,9 +47,10 @@ options = [ "subvol=@" "ssd" - "compress=zstd:3" + "compress=zstd:1" "discard=async" "noatime" + "commit=120" ]; }; @@ -51,9 +61,10 @@ options = [ "subvol=@nix-store" "ssd" - "compress=zstd:3" + "compress=zstd:1" "discard=async" "noatime" + "commit=120" ]; }; @@ -64,9 +75,10 @@ options = [ "subvol=@nix-persist" "ssd" - "compress=zstd:3" + "compress=zstd:1" "discard=async" "noatime" + "commit=120" ]; }; @@ -79,13 +91,11 @@ networking.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.graphics = { enable = true; extraPackages = with pkgs; [ - amdvlk vaapiVdpau libvdpau-va-gl libva diff --git a/hosts/nb/modules/desktop/default.nix b/hosts/nb/modules/desktop/default.nix index 31b0938..01b260a 100644 --- a/hosts/nb/modules/desktop/default.nix +++ b/hosts/nb/modules/desktop/default.nix @@ -110,8 +110,6 @@ in { programs.light.enable = true; - hardware.graphics.extraPackages = [ pkgs.amdvlk ]; - hardware.bluetooth.enable = true; hardware.bluetooth.powerOnBoot = true; hardware.bluetooth.settings = { @@ -123,8 +121,16 @@ in { services.tlp.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_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; STOP_CHARGE_THRESH_BAT0 = 80; }; diff --git a/hosts/nb/modules/ollama.nix b/hosts/nb/modules/ollama.nix index 444aa1a..0c8b240 100644 --- a/hosts/nb/modules/ollama.nix +++ b/hosts/nb/modules/ollama.nix @@ -6,6 +6,7 @@ host = "127.0.0.1"; port = 11434; openFirewall = false; + acceleration = "rocm"; loadModels = [ "mxbai-embed-large" ];