diff --git a/lenovo/z510.nix b/lenovo/ideapad/z510.nix similarity index 76% rename from lenovo/z510.nix rename to lenovo/ideapad/z510.nix index f1f5416..4c45cac 100644 --- a/lenovo/z510.nix +++ b/lenovo/ideapad/z510.nix @@ -1,3 +1,6 @@ +# NOTE: this doesn't inherit from the `general.nix` +# as z510 is not a ThinkPad + { config, pkgs, ... }: { hardware.cpu.intel.updateMicrocode = true; diff --git a/lenovo/thinkpad/general-intel.nix b/lenovo/thinkpad/general-intel.nix new file mode 100644 index 0000000..5aeec18 --- /dev/null +++ b/lenovo/thinkpad/general-intel.nix @@ -0,0 +1,6 @@ +{ ... }: + +{ + boot.kernelModules = mkDefault [ "kvm-intel" ]; + services.xserver.videoDrivers = [ "intel" ]; +} diff --git a/lenovo/thinkpad/general.nix b/lenovo/thinkpad/general.nix new file mode 100644 index 0000000..71db23a --- /dev/null +++ b/lenovo/thinkpad/general.nix @@ -0,0 +1,22 @@ +{ pkgs, lib, ... }: + +with lib; + +{ + hardware.trackpoint = mkDefault { + enable = true; + emulateWheel = true; + }; + + hardware.enableRedistributableFirmware = mkDefault true; + services.tlp.enable = true; + + services.xserver = mkDefault { + synaptics.enable = false; + libinput.enable = true; + }; + + environment.systemPackages = [ pkgs.acpi ]; + + sound.enableMediaKeys = mkDefault true; +} diff --git a/lenovo/t410.nix b/lenovo/thinkpad/t410.nix similarity index 99% rename from lenovo/t410.nix rename to lenovo/thinkpad/t410.nix index 912ae66..5737cc6 100644 --- a/lenovo/t410.nix +++ b/lenovo/thinkpad/t410.nix @@ -1,6 +1,8 @@ { config, pkgs, ... }: { + imports = [ ./general-intel.nix ]; + boot = { kernelParams = [ # Kernel GPU Savings Options (NOTE i915 chipset only) diff --git a/lenovo/t440p.nix b/lenovo/thinkpad/t440p.nix similarity index 65% rename from lenovo/t440p.nix rename to lenovo/thinkpad/t440p.nix index 47f5f66..4d96bbb 100644 --- a/lenovo/t440p.nix +++ b/lenovo/thinkpad/t440p.nix @@ -1,10 +1,12 @@ { config, pkgs, ... }: { + imports = [ ./general-intel.nix ]; + boot = { extraModprobeConfig = '' options bbswitch use_acpi_to_detect_card_state=1 ''; - kernelModules = [ "kvm-intel" "tpm-rng" ]; + kernelModules = [ "tpm-rng" ]; }; } diff --git a/lenovo/t460s.nix b/lenovo/thinkpad/t460s.nix similarity index 71% rename from lenovo/t460s.nix rename to lenovo/thinkpad/t460s.nix index 4aaed14..d6f2ba3 100644 --- a/lenovo/t460s.nix +++ b/lenovo/thinkpad/t460s.nix @@ -3,6 +3,7 @@ { imports = [ ../lib/kernel-version.nix + ./general-intel.nix ]; ## BEGIN from generated hardware-configuration @@ -26,9 +27,6 @@ { version = "4.6"; msg = "Suspending the T460s by closing the lid when running on battery causes the machine to freeze up entirely."; } ]; - # For the wifi (intel iwlwifi) - hardware.enableAllFirmware = true; - # 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): @@ -39,21 +37,4 @@ # Aspect Ratio: 16 × 9 (1.78:1) # Pixel Count: 3,686,400 # Megapixels: 3.69MP - - # Use libinput to let the physical middle button be used to scroll - # with the trackpoint - services.xserver = { - libinput.enable = true; - synaptics.enable = false; - - config = '' - Section "InputClass" - Identifier "Enable libinput for TrackPoint" - MatchIsPointer "on" - Driver "libinput" - Option "ScrollMethod" "button" - Option "ScrollButton" "8" - EndSection - ''; - }; } diff --git a/lenovo/x140e.nix b/lenovo/thinkpad/x140e.nix similarity index 67% rename from lenovo/x140e.nix rename to lenovo/thinkpad/x140e.nix index f825f44..df1f7f3 100644 --- a/lenovo/x140e.nix +++ b/lenovo/thinkpad/x140e.nix @@ -1,6 +1,8 @@ { config, lib, pkgs, ... }: { + imports = [ ./general.nix ]; + boot = { # wireless kernelModules = [ "kvm-amd" "wl" ]; @@ -14,13 +16,4 @@ # video card services.xserver.videoDrivers = ["ati"]; - - # trackpad (touchpad disabled) - hardware.trackpoint = { - enable = true; - emulateWheel = true; - }; - - # media keys - sound.enableMediaKeys = true; } diff --git a/lenovo/x220i-tablet.nix b/lenovo/thinkpad/x220i-tablet.nix similarity index 60% rename from lenovo/x220i-tablet.nix rename to lenovo/thinkpad/x220i-tablet.nix index 7ea8d73..c87df3f 100644 --- a/lenovo/x220i-tablet.nix +++ b/lenovo/thinkpad/x220i-tablet.nix @@ -1,6 +1,8 @@ { config, pkgs, ... }: { + imports = [ ./general-intel.nix ]; + # TPM chip countains a RNG security.rngd.enable = true; @@ -9,22 +11,9 @@ extraModulePackages = [ config.boot.kernelPackages.tp_smapi ]; }; - # TLP Linux Advanced Power Management - services.tlp.enable = true; - # hard disk protection if the laptop falls services.hdapsd.enable = true; - # trackpoint support (touchpad disabled in this config) - hardware.trackpoint.enable = true; - hardware.trackpoint.emulateWheel = true; - - # alternatively, touchpad with two-finger scrolling - #services.xserver.libinput.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; diff --git a/lenovo/x250.nix b/lenovo/x250.nix deleted file mode 100644 index 40d1fb1..0000000 --- a/lenovo/x250.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ config, pkgs, ... }: - -{ - # modesetting driver leads to freezes with newer kernel at the moment (> 4.4) - services.xserver.videoDrivers = [ "intel" ]; - - services.xserver.libinput.enable = true; - hardware.trackpoint.emulateWheel = true; -}