From 00b8bf416c2ea237dede0a469916ab03bad4351b Mon Sep 17 00:00:00 2001 From: Calvin Kim Date: Sun, 8 Sep 2019 02:49:24 +0900 Subject: [PATCH 1/6] maintainers: add kcalvinalvin --- maintainers/maintainer-list.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 7f70963723d..7f8c5730da6 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -3181,6 +3181,12 @@ githubId = 1047859; name = "Kaz Wesley"; }; + kcalvinalvin = { + email = "calvin@kcalvinalvin.info"; + github = "kcalvinalvin"; + githubId = 37185887; + name = "Calvin Kim"; + }; kentjames = { email = "jameschristopherkent@gmail.com"; github = "kentjames"; From feed10306a1e45d701999944b78b92c8c555d59c Mon Sep 17 00:00:00 2001 From: Calvin Kim Date: Sun, 8 Sep 2019 02:53:16 +0900 Subject: [PATCH 2/6] chromium-xorg-conf: init (not versioned) --- pkgs/os-specific/linux/chromium-xorg-conf/default.nix | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 pkgs/os-specific/linux/chromium-xorg-conf/default.nix diff --git a/pkgs/os-specific/linux/chromium-xorg-conf/default.nix b/pkgs/os-specific/linux/chromium-xorg-conf/default.nix new file mode 100644 index 00000000000..58038923890 --- /dev/null +++ b/pkgs/os-specific/linux/chromium-xorg-conf/default.nix @@ -0,0 +1,8 @@ +{fetchgit }: + +fetchgit { + name = "chromium-xorg-conf"; + url = "https://chromium.googlesource.com/chromiumos/platform/xorg-conf"; + rev = "26fb9d57e195c7e467616b35b17e2b5d279c1514"; + sha256 = "0643y3l3hjk4mv4lm3h9z56h990q6k11hcr10lcqppgsii0d3zcf"; +} From ae8c8f82bcb1a4306de307fa58e7aa74f41e2146 Mon Sep 17 00:00:00 2001 From: Calvin Kim Date: Sun, 8 Sep 2019 02:55:27 +0900 Subject: [PATCH 3/6] libevdevc: init at 2.0.1 --- pkgs/os-specific/linux/libevdevc/default.nix | 29 ++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 pkgs/os-specific/linux/libevdevc/default.nix diff --git a/pkgs/os-specific/linux/libevdevc/default.nix b/pkgs/os-specific/linux/libevdevc/default.nix new file mode 100644 index 00000000000..e3dfbd3d6c2 --- /dev/null +++ b/pkgs/os-specific/linux/libevdevc/default.nix @@ -0,0 +1,29 @@ +{ stdenv, fetchFromGitHub, coreutils, pkgconfig, glib, jsoncpp }: + +stdenv.mkDerivation rec { + name = "libevdevc"; + version = "2.0.1"; + src = fetchFromGitHub { + owner = "hugegreenbug"; + repo = "libevdevc"; + rev = "v${version}"; + sha256 = "0ry30krfizh87yckmmv8n082ad91mqhhbbynx1lfidqzb6gdy2dd"; + }; + + postPatch = '' + substituteInPlace common.mk \ + --replace /bin/echo ${coreutils}/bin/echo + substituteInPlace include/module.mk \ + --replace /usr/include /include + ''; + + makeFlags = [ "DESTDIR=$(out)" "LIBDIR=/lib" ]; + + meta = with stdenv.lib; { + description = "ChromiumOS libevdev. Renamed to avoid conflicts with the standard libevdev found in Linux distros."; + license = licenses.bsd3; + platforms = platforms.linux; + homepage = "https://chromium.googlesource.com/chromiumos/platform/libevdev/"; + maintainers = with maintainers; [ kcalvinalvin ]; + }; +} From b084a3dcccd95f4838408e629932f2414f55c2e6 Mon Sep 17 00:00:00 2001 From: Calvin Kim Date: Sun, 8 Sep 2019 03:00:32 +0900 Subject: [PATCH 4/6] libgestures: init at 2.0.1 --- .../os-specific/linux/libgestures/default.nix | 33 +++++++++++++++++++ .../linux/libgestures/include-fix.patch | 12 +++++++ 2 files changed, 45 insertions(+) create mode 100644 pkgs/os-specific/linux/libgestures/default.nix create mode 100644 pkgs/os-specific/linux/libgestures/include-fix.patch diff --git a/pkgs/os-specific/linux/libgestures/default.nix b/pkgs/os-specific/linux/libgestures/default.nix new file mode 100644 index 00000000000..4c51525727a --- /dev/null +++ b/pkgs/os-specific/linux/libgestures/default.nix @@ -0,0 +1,33 @@ +{ stdenv, fetchFromGitHub, pkgconfig, glib, jsoncpp }: + +stdenv.mkDerivation rec { + name = "libgestures-${version}"; + version = "2.0.1"; + src = fetchFromGitHub { + owner = "hugegreenbug"; + repo = "libgestures"; + rev = "v${version}"; + sha256 = "0dfvads2adzx4k8cqc1rbwrk1jm2wn9wl2jk51m26xxpmh1g0zab"; + }; + patches = [ ./include-fix.patch ]; + + postPatch = '' + substituteInPlace Makefile \ + --replace -Werror -Wno-error \ + --replace '$(DESTDIR)/usr/include' '$(DESTDIR)/include' + ''; + + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ glib jsoncpp ]; + + + makeFlags = [ "DESTDIR=$(out)" "LIBDIR=/lib" ]; + + meta = with stdenv.lib; { + description = "ChromiumOS libgestures modified to compile for Linux."; + license = licenses.bsd3; + platforms = platforms.linux; + homepage = "https://chromium.googlesource.com/chromiumos/platform/gestures"; + maintainers = with maintainers; [ kcalvinalvin ]; + }; +} diff --git a/pkgs/os-specific/linux/libgestures/include-fix.patch b/pkgs/os-specific/linux/libgestures/include-fix.patch new file mode 100644 index 00000000000..851be477143 --- /dev/null +++ b/pkgs/os-specific/linux/libgestures/include-fix.patch @@ -0,0 +1,12 @@ +diff -ur a/include/gestures/include/finger_metrics.h b/include/gestures/include/finger_metrics.h +--- a/include/gestures/include/finger_metrics.h 1970-01-01 09:00:01.000000000 +0900 ++++ b/include/gestures/include/finger_metrics.h 2018-12-01 16:58:51.590718511 +0900 +@@ -5,6 +5,8 @@ + #ifndef GESTURES_FINGER_METRICS_H_ + #define GESTURES_FINGER_METRICS_H_ + ++#include ++ + #include "gestures/include/gestures.h" + #include "gestures/include/prop_registry.h" +#include "gestures/include/vector.h" From 5df0605478575fda145f1d0a394ed40505d0d97f Mon Sep 17 00:00:00 2001 From: Calvin Kim Date: Sun, 8 Sep 2019 03:01:18 +0900 Subject: [PATCH 5/6] xf86-input-cmt: init at 2.0.2 --- .../linux/xf86-input-cmt/default.nix | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 pkgs/os-specific/linux/xf86-input-cmt/default.nix diff --git a/pkgs/os-specific/linux/xf86-input-cmt/default.nix b/pkgs/os-specific/linux/xf86-input-cmt/default.nix new file mode 100644 index 00000000000..2422b70b068 --- /dev/null +++ b/pkgs/os-specific/linux/xf86-input-cmt/default.nix @@ -0,0 +1,36 @@ +{ stdenv, fetchFromGitHub, pkgconfig, xorgserver, xorgproto, + utilmacros, libgestures, libevdevc }: + +stdenv.mkDerivation rec { + name = "xf86-input-cmt-${version}"; + version = "2.0.2"; + src = fetchFromGitHub { + owner = "hugegreenbug"; + repo = "xf86-input-cmt"; + rev = "v${version}"; + sha256 = "1cnwf518nc0ybc1r3rsgc1gcql1k3785khffv0i4v3akrm9wdw98"; + }; + + postPatch = '' + patchShebangs ./apply_patches.sh + ./apply_patches.sh + ''; + + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ + xorgserver xorgproto utilmacros + libgestures libevdevc + ]; + + configureFlags = [ + "--with-sdkdir=${placeholder "out"}" + ]; + + meta = with stdenv.lib; { + description = "Chromebook touchpad driver."; + license = licenses.bsd3; + platforms = platforms.linux; + homepage = "www.github.com/hugegreenbug/xf86-input-cmt"; + maintainers = with maintainers; [ kcalvinalvin ]; + }; +} From fa538528043ee125caf8719540d9c2e7abc97391 Mon Sep 17 00:00:00 2001 From: Calvin Kim Date: Sun, 8 Sep 2019 03:02:25 +0900 Subject: [PATCH 6/6] nixos/cmt: add cmt module Adds custom touchpad drivers for Chromebooks. --- nixos/modules/module-list.nix | 1 + nixos/modules/services/x11/hardware/cmt.nix | 54 +++++++++++++++++++++ pkgs/top-level/all-packages.nix | 8 +++ 3 files changed, 63 insertions(+) create mode 100644 nixos/modules/services/x11/hardware/cmt.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 5335ba3abd1..7060aadd90c 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -842,6 +842,7 @@ ./services/x11/hardware/multitouch.nix ./services/x11/hardware/synaptics.nix ./services/x11/hardware/wacom.nix + ./services/x11/hardware/cmt.nix ./services/x11/gdk-pixbuf.nix ./services/x11/redshift.nix ./services/x11/urxvtd.nix diff --git a/nixos/modules/services/x11/hardware/cmt.nix b/nixos/modules/services/x11/hardware/cmt.nix new file mode 100644 index 00000000000..95353e92098 --- /dev/null +++ b/nixos/modules/services/x11/hardware/cmt.nix @@ -0,0 +1,54 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + +cfg = config.services.xserver.cmt; +etcPath = "X11/xorg.conf.d"; + +in { + + options = { + + services.xserver.cmt = { + enable = mkOption { + type = types.bool; + default = false; + description = "Enable chrome multitouch input (cmt). Touchpad drivers that are configured for chromebooks."; + }; + models = mkOption { + 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" ]; + example = "banjo"; + description = '' + Which models to enable cmt for. Enter the Code Name for your Chromebook. + Code Name can be found at . + ''; + }; + }; #closes services + }; #closes options + + config = mkIf cfg.enable { + + services.xserver.modules = [ pkgs.xf86_input_cmt ]; + + environment.etc = { + "${etcPath}/40-touchpad-cmt.conf" = { + source = "${pkgs.chromium-xorg-conf}/40-touchpad-cmt.conf"; + }; + "${etcPath}/50-touchpad-cmt-${cfg.models}.conf" = { + source = "${pkgs.chromium-xorg-conf}/50-touchpad-cmt-${cfg.models}.conf"; + }; + "${etcPath}/60-touchpad-cmt-${cfg.models}.conf" = { + source = "${pkgs.chromium-xorg-conf}/60-touchpad-cmt-${cfg.models}.conf"; + }; + }; + + assertions = [ + { + assertion = !config.services.xserver.libinput.enable; + message = "cmt and libinput are incompatible, you cannot enable both (in services.xserver)."; + } + ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b3ea05b72d6..292d51cd313 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9223,6 +9223,8 @@ in chromedriver = callPackage ../development/tools/selenium/chromedriver { gconf = gnome2.GConf; }; + chromium-xorg-conf = callPackage ../os-specific/linux/chromium-xorg-conf { }; + chrpath = callPackage ../development/tools/misc/chrpath { }; chruby = callPackage ../development/tools/misc/chruby { rubies = null; }; @@ -16435,6 +16437,8 @@ in wpa_supplicant_gui = libsForQt5.callPackage ../os-specific/linux/wpa_supplicant/gui.nix { }; + xf86_input_cmt = callPackage ../os-specific/linux/xf86-input-cmt { }; + xf86_input_mtrack = callPackage ../os-specific/linux/xf86-input-mtrack { }; xf86_input_multitouch = callPackage ../os-specific/linux/xf86-input-multitouch { }; @@ -16733,6 +16737,10 @@ in liberation-sans-narrow = callPackage ../data/fonts/liberation-sans-narrow { }; + libevdevc = callPackage ../os-specific/linux/libevdevc { }; + + libgestures = callPackage ../os-specific/linux/libgestures { }; + liberastika = callPackage ../data/fonts/liberastika { }; libertine = callPackage ../data/fonts/libertine { };