at 23.11-pre 2.2 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 7cfg = config.services.xserver.cmt; 8etcPath = "X11/xorg.conf.d"; 9 10in { 11 12 options = { 13 14 services.xserver.cmt = { 15 enable = mkOption { 16 type = types.bool; 17 default = false; 18 description = lib.mdDoc "Enable chrome multitouch input (cmt). Touchpad drivers that are configured for chromebooks."; 19 }; 20 models = mkOption { 21 type = types.enum [ "atlas" "banjo" "candy" "caroline" "cave" "celes" "clapper" "cyan" "daisy" "elan" "elm" "enguarde" "eve" "expresso" "falco" "gandof" "glimmer" "gnawty" "heli" "kevin" "kip" "leon" "lulu" "orco" "pbody" "peppy" "pi" "pit" "puppy" "quawks" "rambi" "samus" "snappy" "spring" "squawks" "swanky" "winky" "wolf" "auron_paine" "auron_yuna" "daisy_skate" "nyan_big" "nyan_blaze" "veyron_jaq" "veyron_jerry" "veyron_mighty" "veyron_minnie" "veyron_speedy" ]; 22 example = "banjo"; 23 description = lib.mdDoc '' 24 Which models to enable cmt for. Enter the Code Name for your Chromebook. 25 Code Name can be found at <https://www.chromium.org/chromium-os/developer-information-for-chrome-os-devices>. 26 ''; 27 }; 28 }; #closes services 29 }; #closes options 30 31 config = mkIf cfg.enable { 32 33 services.xserver.modules = [ pkgs.xf86_input_cmt ]; 34 35 environment.etc = { 36 "${etcPath}/40-touchpad-cmt.conf" = { 37 source = "${pkgs.chromium-xorg-conf}/40-touchpad-cmt.conf"; 38 }; 39 "${etcPath}/50-touchpad-cmt-${cfg.models}.conf" = { 40 source = "${pkgs.chromium-xorg-conf}/50-touchpad-cmt-${cfg.models}.conf"; 41 }; 42 "${etcPath}/60-touchpad-cmt-${cfg.models}.conf" = { 43 source = "${pkgs.chromium-xorg-conf}/60-touchpad-cmt-${cfg.models}.conf"; 44 }; 45 }; 46 47 assertions = [ 48 { 49 assertion = !config.services.xserver.libinput.enable; 50 message = '' 51 cmt and libinput are incompatible, meaning you cannot enable them both. 52 To use cmt you need to disable libinput with `services.xserver.libinput.enable = false` 53 If you haven't enabled it in configuration.nix, it's enabled by default on a 54 different xserver module. 55 ''; 56 } 57 ]; 58 }; 59}