{ config, pkgs, lib, ... }: { # === T490-specific hardware configuration === # Requires nixos-hardware flake input: nixos-hardware.nixosModules.lenovo-thinkpad-t490 # The nixos-hardware module provides: # - services.throttled (CPU throttling fix) # - PulseAudio profile set (5 simultaneous sinks) # - common/cpu/intel (VA-API drivers, microcode) # === Kernel parameters === boot.kernelParams = [ "mem_sleep_default=deep" # prefer S3 deep sleep over s2idle "pcie_aspm=force" # PCIe Active State Power Management "i915.enable_fbc=1" # frame buffer compression (power saving) "i915.enable_psr=1" # panel self-refresh (power saving) "i915.enable_rc6=7" # maximum GPU render power saving ]; boot.kernelModules = [ "thinkpad_acpi" ]; boot.blacklistedKernelModules = [ "iTCO_wdt" "iTCO_vendor_support" ]; # === Display DPI === services.xserver.dpi = 157; # 14" 1920×1080 IPS = 157 DPI # === Firmware updates === services.fwupd.enable = true; # === Fingerprint reader (Synaptics 06cb:00bd) === # Requires firmware update via fwupd first services.fprintd.enable = true; # === TLP — ThinkPad power management === # nixos-hardware thinkpad module provides base config; tune here services.tlp = { enable = true; settings = { CPU_SCALING_GOVERNOR_ON_AC = "performance"; CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; CPU_ENERGY_PERF_POLICY_ON_AC = "balance_performance"; CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; CPU_MAX_PERF_ON_AC = 100; CPU_MAX_PERF_ON_BAT = 40; # cap at ~1.7 GHz on battery CPU_BOOST_ON_AC = 1; CPU_BOOST_ON_BAT = 0; # disable turbo on battery START_CHARGE_THRESH_BAT0 = 40; # battery health: start charging below 40% STOP_CHARGE_THRESH_BAT0 = 80; # battery health: stop at 80% WIFI_PWR_ON_AC = "off"; WIFI_PWR_ON_BAT = "on"; RUNTIME_PM_ON_AC = "on"; RUNTIME_PM_ON_BAT = "auto"; USB_AUTOSUSPEND = 1; INTEL_GPU_MIN_FREQ_ON_AC = 300; INTEL_GPU_MAX_FREQ_ON_AC = 1100; INTEL_GPU_MIN_FREQ_ON_BAT = 300; INTEL_GPU_MAX_FREQ_ON_BAT = 600; }; }; # === powertop === powerManagement.powertop.enable = true; # === throttled — undervolt + raise trip temp for better sustained perf === services.throttled = { extraConfig = '' [GENERAL] Enabled: True Sysfs_Power_Path: /sys/class/power_supply/AC*/online Autoreload: True [BATTERY] Update_Rate_s: 30 PL1_Tdp_W: 29 PL1_Duration_s: 28 PL2_Tdp_W: 29 PL2_Duration_S: 0.002 Trip_Temp_C: 85 cTDP: 0 Disable_BDPROCHOT: False [AC] Update_Rate_s: 5 PL1_Tdp_W: 44 PL1_Duration_s: 28 PL2_Tdp_W: 44 PL2_Duration_S: 0.002 Trip_Temp_C: 97 cTDP: 0 Disable_BDPROCHOT: False [UNDERVOLT.BATTERY] CORE: -70 GPU: -50 CACHE: -70 UNCORE: -40 ANALOGIO: -40 [UNDERVOLT.AC] CORE: -80 GPU: -50 CACHE: -80 UNCORE: -50 ANALOGIO: -50 ''; }; # Skip thermald — conflicts with throttled services.thermald.enable = false; # === zram swap (faster + saves NVMe writes) === zramSwap = { enable = true; memoryPercent = 50; }; # === Intel GPU — hardware video acceleration === hardware.graphics = { enable = true; extraPackages = with pkgs; [ intel-media-driver # modern VA-API (iHD) intel-vaapi-driver # legacy VA-API (i965) libvdpau-va-gl # VDPAU → VA-API bridge ]; }; environment.sessionVariables = { LIBVA_DRIVER_NAME = "iHD"; MOZ_ENABLE_WAYLAND = "1"; }; # === Suspend/resume: reload WiFi after wake === powerManagement.powerUpCommands = '' ${pkgs.kmod}/bin/modprobe -r iwlmvm iwlwifi || true ${pkgs.kmod}/bin/modprobe iwlwifi || true ''; # === Remote Nix builders (k3s cluster) === nix.distributedBuilds = true; nix.buildMachines = [ { hostName = "n97-mini"; system = "x86_64-linux"; maxJobs = 4; supportedFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ]; sshUser = "root"; sshKey = "/root/.ssh/remote-build"; } { hostName = "n97"; system = "x86_64-linux"; maxJobs = 4; supportedFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ]; sshUser = "root"; sshKey = "/root/.ssh/remote-build"; } ]; # === Syncthing (Obsidian vault sync) === services.syncthing = { enable = true; user = "sscoble"; dataDir = "/home/sscoble/.syncthing"; configDir = "/home/sscoble/.syncthing/config"; }; # === Tailscale (consistent cluster access from any network) === services.tailscale.enable = true; # === Proton Mail Bridge (local IMAP/SMTP for Proton Mail) === # The systemd user service is defined in home/desktop.nix # === NVMe tools === environment.systemPackages = with pkgs; [ nvme-cli protonmail-bridge ]; # === Touchpad & TrackPoint === services.libinput = { enable = true; touchpad = { tapping = true; naturalScrolling = true; accelSpeed = "0.3"; disableWhileTyping = true; }; }; # TrackPoint sensitivity services.udev.extraRules = '' ACTION=="add", SUBSYSTEM=="input", ATTR{name}=="*TrackPoint*", \ ATTR{device/sensitivity}="200", ATTR{device/speed}="150" ''; }