Segregate lenovo/ subdir into thinkpad and ideapad directories

There are several significant differences between ThinkPads and the
other Lenovo models, so this structure must be more precise
This commit is contained in:
Maximilian Bosch
2017-09-03 23:34:57 +02:00
parent ed46b99315
commit d977cf26de
8 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
{ lib, ... }:
with lib;
{
hardware.trackpoint = mkDefault {
enable = true;
emulateWheel = true;
};
hardware.enableAllFirmware = true;
services.tlp.enable = true;
services.xserver = {
synaptics.enable = false;
libinput.enable = true;
};
}

80
lenovo/thinkpad/t410.nix Normal file
View File

@@ -0,0 +1,80 @@
{ config, pkgs, ... }:
{
imports = [ ./general.nix ];
boot = {
kernelParams = [
# Kernel GPU Savings Options (NOTE i915 chipset only)
"drm.debug=0" "drm.vblankoffdelay=1" "i915.semaphores=1" "i915.modeset=1"
"i915.use_mmio_flip=1" "i915.powersave=1" "i915.enable_ips=1"
"i915.disable_power_well=1" "i915.enable_hangcheck=1"
"i915.enable_cmd_parser=1" "i915.fastboot=0" "i915.enable_ppgtt=1"
"i915.reset=0" "i915.lvds_use_ssc=0" "i915.enable_psr=0" "vblank_mode=0"
"i915.i915_enable_rc6=1"
];
blacklistedKernelModules = [
# Kernel GPU Savings Options (NOTE i915 chipset only)
"sierra_net" "cdc_mbim" "cdc_ncm" "btusb"
];
};
hardware.cpu.intel.updateMicrocode = true;
systemd.services.tune-powermanagement = {
description = "Tune Powermanagement";
serviceConfig.Type = "oneshot";
serviceConfig.RemainAfterExit = true;
wantedBy = [ "multi-user.target" ];
unitConfig.RequiresMountsFor = "/sys";
script = ''
echo '1500' > '/proc/sys/vm/dirty_writeback_centisecs'
echo '1' > '/sys/module/snd_hda_intel/parameters/power_save'
echo 'auto' > '/sys/bus/i2c/devices/i2c-0/device/power/control'
echo 'auto' > '/sys/bus/i2c/devices/i2c-1/device/power/control'
echo 'auto' > '/sys/bus/i2c/devices/i2c-2/device/power/control'
echo 'auto' > '/sys/bus/i2c/devices/i2c-3/device/power/control'
echo 'auto' > '/sys/bus/i2c/devices/i2c-4/device/power/control'
echo 'auto' > '/sys/bus/i2c/devices/i2c-5/device/power/control'
echo 'auto' > '/sys/bus/i2c/devices/i2c-6/device/power/control'
echo 'auto' > '/sys/bus/i2c/devices/i2c-7/device/power/control'
echo 'auto' > '/sys/bus/i2c/devices/i2c-8/device/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:00.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:02.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:16.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:16.3/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:19.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1a.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1b.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.1/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.3/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.4/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1d.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1e.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.2/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.3/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.6/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:03:00.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:0d:00.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:0d:00.1/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:ff:00.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:ff:00.1/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:ff:02.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:ff:02.1/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:ff:02.2/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:ff:02.3/power/control'
echo 'auto' > '/sys/bus/usb/devices/1-1.3/power/control'
echo 'min_power' > '/sys/class/scsi_host/host0/link_power_management_policy'
echo 'min_power' > '/sys/class/scsi_host/host1/link_power_management_policy'
echo 'min_power' > '/sys/class/scsi_host/host2/link_power_management_policy'
echo 'min_power' > '/sys/class/scsi_host/host3/link_power_management_policy'
echo 'min_power' > '/sys/class/scsi_host/host4/link_power_management_policy'
echo 'min_power' > '/sys/class/scsi_host/host5/link_power_management_policy'
/run/current-system/sw/bin/rmmod e1000e || true
'';
# ${pkgs.ethtool}/bin/ethtool -s enp0s25 wol d || true
};
}

12
lenovo/thinkpad/t440p.nix Normal file
View File

@@ -0,0 +1,12 @@
{ config, pkgs, ... }:
{
imports = [ ./general.nix ];
boot = {
extraModprobeConfig = ''
options bbswitch use_acpi_to_detect_card_state=1
'';
kernelModules = [ "kvm-intel" "tpm-rng" ];
};
}

40
lenovo/thinkpad/t460s.nix Normal file
View File

@@ -0,0 +1,40 @@
{ config, pkgs, ... }:
{
imports =
[ ../lib/kernel-version.nix
./general.nix
];
## BEGIN from generated hardware-configuration
## Probably better to just use a freshly generated hardware.configuration.nix
## than this, but including for reference.
# boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
# boot.kernelModules = [ "kvm-intel" ];
# boot.extraModulePackages = [ ];
#
#
# nix.maxJobs = lib.mkDefault 4;
## END from generated hardware-configuration
# Use the gummiboot efi boot loader. (From default generated configuration.nix)
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_T460s
kernelAtleast = [
{ version = "4.5.1"; msg = "The physical mouse buttons works incorrectly."; }
{ version = "4.6"; msg = "Suspending the T460s by closing the lid when running on battery causes the machine to freeze up entirely."; }
];
# For the screen. I don't know what to do with this information, but
# the hiDPI support is far from perfect (as of July 2016):
# Resolution: 2560 x 1440 px
# Size: 12.2" × 6.86" (30.99cm × 17.43cm)
# DPI: 209.8
# Dot Pitch: 0.1211mm
# Aspect Ratio: 16 × 9 (1.78:1)
# Pixel Count: 3,686,400
# Megapixels: 3.69MP
}

22
lenovo/thinkpad/x140e.nix Normal file
View File

@@ -0,0 +1,22 @@
{ config, lib, pkgs, ... }:
{
imports = [ ./general.nix ];
boot = {
# wireless
kernelModules = [ "kvm-amd" "wl" ];
extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];
# audio device
extraModprobeConfig = ''
options snd_hda_intel enable=0,1
'';
};
# video card
services.xserver.videoDrivers = ["ati"];
# media keys
sound.enableMediaKeys = true;
}

View File

@@ -0,0 +1,25 @@
{ config, pkgs, ... }:
{
imports = [ ./general.nix ];
# TPM chip countains a RNG
security.rngd.enable = true;
boot = {
kernelModules = [ "tp_smapi" ];
extraModulePackages = [ config.boot.kernelPackages.tp_smapi ];
};
# hard disk protection if the laptop falls
services.hdapsd.enable = true;
# enable volume control buttons
sound.enableMediaKeys = true;
# fingerprint reader: login and unlock with fingerprint (if you add one with `fprintd-enroll`)
#services.fprintd.enable = true;
#security.pam.services.login.fprintAuth = true;
#security.pam.services.xscreensaver.fprintAuth = true;
# similarly for other PAM providers
}

8
lenovo/thinkpad/x250.nix Normal file
View File

@@ -0,0 +1,8 @@
{ config, pkgs, ... }:
{
imports = [ ./general.nix ];
# modesetting driver leads to freezes with newer kernel at the moment (> 4.4)
services.xserver.videoDrivers = [ "intel" ];
}