home

My NixOS systems configurations.
Log | Files | Refs | LICENSE

lenovo-p50.nix (1919B)


      1 { config, pkgs, lib, ... }:
      2 #let
      3 #  sources = import ../../nix/sources.nix;
      4 #in
      5 {
      6   imports = [
      7     # (sources.nixos-hardware + "/common/pc/ssd")
      8     ./thinkpad.nix
      9   ];
     10   boot = {
     11     initrd.availableKernelModules = [ "nvme" "rtsx_pci_sdmmc" ];
     12   };
     13   hardware = {
     14 
     15     enableAllFirmware = true;
     16     bluetooth = {
     17       enable = true;
     18       powerOnBoot = true;
     19     };
     20     nvidia.prime = {
     21       sync.enable = true;
     22       nvidiaBusId = "PCI:1:0:0";
     23       intelBusId = "PCI:0:2:0";
     24     };
     25   };
     26   nix.maxJobs = 12;
     27   services.throttled.enable = lib.mkDefault true;
     28   services = {
     29     tlp = {
     30       settings = {
     31         # CPU optimizations
     32         "CPU_SCALING_GOVERNOR_ON_AC" = "performance";
     33         "CPU_SCALING_GOVERNOR_ON_BAT" = "powersave";
     34         "CPU_MIN_PERF_ON_AC" = 0;
     35         "CPU_MAX_PERF_ON_AC" = 100;
     36         "CPU_MIN_PERF_ON_BAT" = 0;
     37         "CPU_MAX_PERF_ON_BAT" = 50;
     38         # DEVICES (wifi, ..)
     39         "DEVICES_TO_DISABLE_ON_STARTUP" = "";
     40         "DEVICES_TO_ENABLE_ON_AC" = "bluetooth wifi wwan";
     41         "DEVICES_TO_DISABLE_ON_BAT" = "";
     42         # Network management
     43         "DEVICES_TO_DISABLE_ON_LAN_CONNECT" = "";
     44         "DEVICES_TO_DISABLE_ON_WIFI_CONNECT" = "";
     45         "DEVICES_TO_DISABLE_ON_WWAN_CONNECT" = "";
     46         "DEVICES_TO_ENABLE_ON_LAN_DISCONNECT" = "";
     47         "DEVICES_TO_ENABLE_ON_WIFI_DISCONNECT" = "";
     48         "DEVICES_TO_ENABLE_ON_WWAN_DISCONNECT" = "";
     49         # Docking
     50         "DEVICES_TO_DISABLE_ON_DOCK" = "wifi";
     51         "DEVICES_TO_ENABLE_ON_UNDOCK" = "wifi";
     52         # Make sure it uses the right hard drive
     53         "DISK_DEVICES" = "nvme0n1p2";
     54       };
     55     };
     56     udev.extraRules = ''
     57       # Rules for Lenovo Thinkpad WS Dock
     58       SUBSYSTEM=="usb", ACTION=="add|remove", ENV{ID_VENDOR}=="17ef", ENV{ID_MODEL}=="305a", RUN+="${pkgs.vde-thinkpad}/bin/dock"
     59       ACTION=="add", SUBSYSTEM=="thunderbolt", ATTR{authorized}=="0", ATTR{authorized}="1"
     60     '';
     61   };
     62 }