{ config, lib, pkgs, ... }: let cfg = config.orbekk.thinkpad; in { options = { orbekk.thinkpad = { enable = lib.mkEnableOption "Enable thinkpad config"; }; }; config = lib.mkIf cfg.enable { services = { 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 ''; }; }; }; }