git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #67241 from kcalvinalvin/cmt

nixos/modules/services/x11/hardware/: add cmt module

commit916603c03cd276e64b6b4135dcdd6e8e23f6dfe6 authorSilvan Mosberger <contact@infinisil.com> dateSun 8 Sep 2019, 22:33 (7 years ago) parent8977ae2fa53852
9 files changed+187
maintainers/maintainer-list.nix+6 nixos/modules/module-list.nix+1 nixos/modules/services/x11/hardware/cmt.nix+54 pkgs/os-specific/linux/chromium-xorg-conf/default.nix+8 pkgs/os-specific/linux/libevdevc/default.nix+29 pkgs/os-specific/linux/libgestures/default.nix+33 pkgs/os-specific/linux/libgestures/include-fix.patch+12 pkgs/os-specific/linux/xf86-input-cmt/default.nix+36 pkgs/top-level/all-packages.nix+8
maintainers/maintainer-list.nix+6
@@ -3249,6 +3249,12 @@
32493249 githubId = 1047859;
32503250 name = "Kaz Wesley";
32513251 };
3252+ kcalvinalvin = {
3253+ email = "calvin@kcalvinalvin.info";
3254+ github = "kcalvinalvin";
3255+ githubId = 37185887;
3256+ name = "Calvin Kim";
3257+ };
32523258 kentjames = {
32533259 email = "jameschristopherkent@gmail.com";
32543260 github = "kentjames";
nixos/modules/module-list.nix+1
@@ -853,6 +853,7 @@
853853 ./services/x11/hardware/multitouch.nix
854854 ./services/x11/hardware/synaptics.nix
855855 ./services/x11/hardware/wacom.nix
856+ ./services/x11/hardware/cmt.nix
856857 ./services/x11/gdk-pixbuf.nix
857858 ./services/x11/redshift.nix
858859 ./services/x11/urxvtd.nix
nixos/modules/services/x11/hardware/cmt.nixnew file+54
@@ -0,0 +1,54 @@
1+{ config, lib, pkgs, ... }:
2+
3+with lib;
4+
5+let
6+
7+cfg = config.services.xserver.cmt;
8+etcPath = "X11/xorg.conf.d";
9+
10+in {
11+
12+ options = {
13+
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 <link xlink:href="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 = "cmt and libinput are incompatible, you cannot enable both (in services.xserver).";
51+ }
52+ ];
53+ };
54+}
pkgs/os-specific/linux/chromium-xorg-conf/default.nixnew file+8
@@ -0,0 +1,8 @@
1+{fetchgit }:
2+
3+fetchgit {
4+ name = "chromium-xorg-conf";
5+ url = "https://chromium.googlesource.com/chromiumos/platform/xorg-conf";
6+ rev = "26fb9d57e195c7e467616b35b17e2b5d279c1514";
7+ sha256 = "0643y3l3hjk4mv4lm3h9z56h990q6k11hcr10lcqppgsii0d3zcf";
8+}
pkgs/os-specific/linux/libevdevc/default.nixnew file+29
@@ -0,0 +1,29 @@
1+{ stdenv, fetchFromGitHub, coreutils, pkgconfig, glib, jsoncpp }:
2+
3+stdenv.mkDerivation rec {
4+ name = "libevdevc";
5+ version = "2.0.1";
6+ src = fetchFromGitHub {
7+ owner = "hugegreenbug";
8+ repo = "libevdevc";
9+ rev = "v${version}";
10+ sha256 = "0ry30krfizh87yckmmv8n082ad91mqhhbbynx1lfidqzb6gdy2dd";
11+ };
12+
13+ postPatch = ''
14+ substituteInPlace common.mk \
15+ --replace /bin/echo ${coreutils}/bin/echo
16+ substituteInPlace include/module.mk \
17+ --replace /usr/include /include
18+ '';
19+
20+ makeFlags = [ "DESTDIR=$(out)" "LIBDIR=/lib" ];
21+
22+ meta = with stdenv.lib; {
23+ description = "ChromiumOS libevdev. Renamed to avoid conflicts with the standard libevdev found in Linux distros.";
24+ license = licenses.bsd3;
25+ platforms = platforms.linux;
26+ homepage = "https://chromium.googlesource.com/chromiumos/platform/libevdev/";
27+ maintainers = with maintainers; [ kcalvinalvin ];
28+ };
29+}
pkgs/os-specific/linux/libgestures/default.nixnew file+33
@@ -0,0 +1,33 @@
1+{ stdenv, fetchFromGitHub, pkgconfig, glib, jsoncpp }:
2+
3+stdenv.mkDerivation rec {
4+ name = "libgestures-${version}";
5+ version = "2.0.1";
6+ src = fetchFromGitHub {
7+ owner = "hugegreenbug";
8+ repo = "libgestures";
9+ rev = "v${version}";
10+ sha256 = "0dfvads2adzx4k8cqc1rbwrk1jm2wn9wl2jk51m26xxpmh1g0zab";
11+ };
12+ patches = [ ./include-fix.patch ];
13+
14+ postPatch = ''
15+ substituteInPlace Makefile \
16+ --replace -Werror -Wno-error \
17+ --replace '$(DESTDIR)/usr/include' '$(DESTDIR)/include'
18+ '';
19+
20+ nativeBuildInputs = [ pkgconfig ];
21+ buildInputs = [ glib jsoncpp ];
22+
23+
24+ makeFlags = [ "DESTDIR=$(out)" "LIBDIR=/lib" ];
25+
26+ meta = with stdenv.lib; {
27+ description = "ChromiumOS libgestures modified to compile for Linux.";
28+ license = licenses.bsd3;
29+ platforms = platforms.linux;
30+ homepage = "https://chromium.googlesource.com/chromiumos/platform/gestures";
31+ maintainers = with maintainers; [ kcalvinalvin ];
32+ };
33+}
pkgs/os-specific/linux/libgestures/include-fix.patchnew file+12
@@ -0,0 +1,12 @@
1+diff -ur a/include/gestures/include/finger_metrics.h b/include/gestures/include/finger_metrics.h
2+--- a/include/gestures/include/finger_metrics.h 1970-01-01 09:00:01.000000000 +0900
3++++ b/include/gestures/include/finger_metrics.h 2018-12-01 16:58:51.590718511 +0900
4+@@ -5,6 +5,8 @@
5+ #ifndef GESTURES_FINGER_METRICS_H_
6+ #define GESTURES_FINGER_METRICS_H_
7+
8++#include <math.h>
9++
10+ #include "gestures/include/gestures.h"
11+ #include "gestures/include/prop_registry.h"
12+#include "gestures/include/vector.h"
pkgs/os-specific/linux/xf86-input-cmt/default.nixnew file+36
@@ -0,0 +1,36 @@
1+{ stdenv, fetchFromGitHub, pkgconfig, xorgserver, xorgproto,
2+ utilmacros, libgestures, libevdevc }:
3+
4+stdenv.mkDerivation rec {
5+ name = "xf86-input-cmt-${version}";
6+ version = "2.0.2";
7+ src = fetchFromGitHub {
8+ owner = "hugegreenbug";
9+ repo = "xf86-input-cmt";
10+ rev = "v${version}";
11+ sha256 = "1cnwf518nc0ybc1r3rsgc1gcql1k3785khffv0i4v3akrm9wdw98";
12+ };
13+
14+ postPatch = ''
15+ patchShebangs ./apply_patches.sh
16+ ./apply_patches.sh
17+ '';
18+
19+ nativeBuildInputs = [ pkgconfig ];
20+ buildInputs = [
21+ xorgserver xorgproto utilmacros
22+ libgestures libevdevc
23+ ];
24+
25+ configureFlags = [
26+ "--with-sdkdir=${placeholder "out"}"
27+ ];
28+
29+ meta = with stdenv.lib; {
30+ description = "Chromebook touchpad driver.";
31+ license = licenses.bsd3;
32+ platforms = platforms.linux;
33+ homepage = "www.github.com/hugegreenbug/xf86-input-cmt";
34+ maintainers = with maintainers; [ kcalvinalvin ];
35+ };
36+}
pkgs/top-level/all-packages.nix+8
@@ -9309,6 +9309,8 @@ in
93099309
93109310 chromedriver = callPackage ../development/tools/selenium/chromedriver { gconf = gnome2.GConf; };
93119311
9312+ chromium-xorg-conf = callPackage ../os-specific/linux/chromium-xorg-conf { };
9313+
93129314 chrpath = callPackage ../development/tools/misc/chrpath { };
93139315
93149316 chruby = callPackage ../development/tools/misc/chruby { rubies = null; };
@@ -16512,6 +16514,8 @@ in
1651216514
1651316515 wpa_supplicant_gui = libsForQt5.callPackage ../os-specific/linux/wpa_supplicant/gui.nix { };
1651416516
16517+ xf86_input_cmt = callPackage ../os-specific/linux/xf86-input-cmt { };
16518+
1651516519 xf86_input_mtrack = callPackage ../os-specific/linux/xf86-input-mtrack { };
1651616520
1651716521 xf86_input_multitouch = callPackage ../os-specific/linux/xf86-input-multitouch { };
@@ -16810,6 +16814,10 @@ in
1681016814
1681116815 liberation-sans-narrow = callPackage ../data/fonts/liberation-sans-narrow { };
1681216816
16817+ libevdevc = callPackage ../os-specific/linux/libevdevc { };
16818+
16819+ libgestures = callPackage ../os-specific/linux/libgestures { };
16820+
1681316821 liberastika = callPackage ../data/fonts/liberastika { };
1681416822
1681516823 libertine = callPackage ../data/fonts/libertine { };