diff options
author | Kjetil Orbekk <kj@orbekk.com> | 2021-03-07 15:11:56 -0500 |
---|---|---|
committer | Kjetil Orbekk <kj@orbekk.com> | 2021-03-07 15:11:56 -0500 |
commit | 78529ae2641e8645ee3459753819d0ecff655d86 (patch) | |
tree | 03f2f8e25ad0decd0f6dcd0a65664a8f7a90796a /modules/thinkpad.nix | |
parent | 46e1d2a1552d4aaad676faf49cb0582515d62c86 (diff) |
Refactor configs into modules
Diffstat (limited to 'modules/thinkpad.nix')
-rw-r--r-- | modules/thinkpad.nix | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/modules/thinkpad.nix b/modules/thinkpad.nix new file mode 100644 index 0000000..df24573 --- /dev/null +++ b/modules/thinkpad.nix @@ -0,0 +1,43 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.orbekk.desktop; +in +{ + options = { + orbekk.thinkpad = { + enable = lib.mkEnableOption "Enable standard desktop config"; + }; + }; + + config = { + services = { + tlp = { + enable = true; + settings = { + "SATA_LINKPWR_ON_BAT" = "max_performance"; + }; + }; + xserver.xkbModel = "thinkpad60"; + }; + + boot = { + kernelModules = [ "tp_smapi" "thinkpad_acpi" "fbcon" "i915" "acpi_call" ]; + extraModulePackages = with config.boot.kernelPackages; [ tp_smapi acpi_call ]; + }; + + systemd.services = { + battery_threshold = { + description = "Set battery charging thresholds."; + path = [ pkgs.tpacpi-bat ]; + after = [ "basic.target" ]; + wantedBy = [ "multi-user.target" ]; + script = '' + tpacpi-bat -s ST 1 39 + tpacpi-bat -s ST 2 39 + tpacpi-bat -s SP 1 80 + tpacpi-bat -s SP 2 80 + ''; + }; + }; + }; +} |