From 08e080ae11656ce0e2d6422ac19285e82b5f70a1 Mon Sep 17 00:00:00 2001 From: Yegor Timoshenko Date: Sun, 24 Dec 2017 15:26:31 +0000 Subject: [PATCH] thinkpad: only enable tp_smapi on compatible ThinkPads, closes #36 --- lenovo/thinkpad/default.nix | 7 +------ lenovo/thinkpad/t410/default.nix | 2 +- lenovo/thinkpad/tp-smapi.nix | 11 +++++++++++ lenovo/thinkpad/x220/default.nix | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 lenovo/thinkpad/tp-smapi.nix diff --git a/lenovo/thinkpad/default.nix b/lenovo/thinkpad/default.nix index 9b82b8b..ae9804b 100644 --- a/lenovo/thinkpad/default.nix +++ b/lenovo/thinkpad/default.nix @@ -1,11 +1,6 @@ -{ config, lib, pkgs, ... }: +{ lib, pkgs, ... }: { - boot = { - kernelModules = [ "tp_smapi" ]; - extraModulePackages = with config.boot.kernelPackages; [ tp_smapi ]; - }; - hardware.trackpoint.enable = lib.mkDefault true; services.tlp.enable = lib.mkDefault true; services.xserver.libinput.enable = lib.mkDefault true; diff --git a/lenovo/thinkpad/t410/default.nix b/lenovo/thinkpad/t410/default.nix index ec8cbc7..568d9e6 100644 --- a/lenovo/thinkpad/t410/default.nix +++ b/lenovo/thinkpad/t410/default.nix @@ -1,7 +1,7 @@ { config, lib, pkgs, ... }: { - imports = [ ../. ]; + imports = [ ../. ../tp-smapi.nix ]; boot = { kernelParams = [ diff --git a/lenovo/thinkpad/tp-smapi.nix b/lenovo/thinkpad/tp-smapi.nix new file mode 100644 index 0000000..451dd28 --- /dev/null +++ b/lenovo/thinkpad/tp-smapi.nix @@ -0,0 +1,11 @@ +# tp_smapi works on ThinkPads made before 2013. See compat table: +# https://www.thinkwiki.org/wiki/Tp_smapi#Model-specific_status + +{ config, ... }: + +{ + boot = { + kernelModules = [ "tp_smapi" ]; + extraModulePackages = with config.boot.kernelPackages; [ tp_smapi ]; + }; +} diff --git a/lenovo/thinkpad/x220/default.nix b/lenovo/thinkpad/x220/default.nix index d3e723d..efa67fc 100644 --- a/lenovo/thinkpad/x220/default.nix +++ b/lenovo/thinkpad/x220/default.nix @@ -1,7 +1,7 @@ { config, lib, pkgs, ... }: { - imports = [ ../. ]; + imports = [ ../. ../tp-smapi.nix ]; # hard disk protection if the laptop falls services.hdapsd.enable = lib.mkDefault true;