grafana-alloy: don't build the frontend twice
[NixPkgs.git] / nixos / modules / services / x11 / hardware / cmt.nix
blob53906c5c716f43ab648199bab64be5440fe6d4ac
1 { config, lib, pkgs, ... }:
3 with lib;
5 let
7 cfg = config.services.xserver.cmt;
8 etcPath = "X11/xorg.conf.d";
10 in {
12   options = {
14     services.xserver.cmt = {
15       enable = mkOption {
16         type = types.bool;
17         default = false;
18         description = "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 = ''
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
31   config = mkIf cfg.enable {
33     services.xserver.modules = [ pkgs.xf86_input_cmt ];
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     };
47     assertions = [
48       {
49         assertion = !config.services.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.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   };