about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/inputmethods/interception-tools
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/inputmethods/interception-tools')
-rw-r--r--nixpkgs/pkgs/tools/inputmethods/interception-tools/caps2esc.nix23
-rw-r--r--nixpkgs/pkgs/tools/inputmethods/interception-tools/default.nix33
-rw-r--r--nixpkgs/pkgs/tools/inputmethods/interception-tools/fix-udevmon-configuration-job-path.patch32
3 files changed, 88 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/inputmethods/interception-tools/caps2esc.nix b/nixpkgs/pkgs/tools/inputmethods/interception-tools/caps2esc.nix
new file mode 100644
index 000000000000..7e6206eb1f37
--- /dev/null
+++ b/nixpkgs/pkgs/tools/inputmethods/interception-tools/caps2esc.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitLab, cmake }:
+
+stdenv.mkDerivation rec {
+  pname = "caps2esc";
+  version = "0.1.3";
+
+  src = fetchFromGitLab {
+    owner = "interception/linux/plugins";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "10xv56vh5h3lxyii3ni166ddv1sz2pylrjmdwxhb4gd2p5zgl1ji";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = with stdenv.lib; {
+    homepage = "https://gitlab.com/interception/linux/plugins/caps2esc";
+    description = "Transforming the most useless key ever into the most useful one";
+    license = licenses.mit;
+    maintainers = [ maintainers.vyp ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/inputmethods/interception-tools/default.nix b/nixpkgs/pkgs/tools/inputmethods/interception-tools/default.nix
new file mode 100644
index 000000000000..39a28214fe20
--- /dev/null
+++ b/nixpkgs/pkgs/tools/inputmethods/interception-tools/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, pkgconfig, cmake, libyamlcpp,
+  libevdev, udev }:
+
+let
+  version = "0.2.1";
+  baseName = "interception-tools";
+in stdenv.mkDerivation {
+  name = "${baseName}-${version}";
+
+  src = fetchurl {
+    url = "https://gitlab.com/interception/linux/tools/repository/v${version}/archive.tar.gz";
+    sha256 = "0lqz89wsf9r5xdgflincysxg4l8fpgg5z8zczhhrg9s5787srfzi";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+  buildInputs = [ libevdev udev libyamlcpp ];
+
+  prePatch = ''
+    substituteInPlace CMakeLists.txt --replace \
+      '"/usr/include/libevdev-1.0"' \
+      "\"$(pkg-config --cflags libevdev | cut -c 3-)\""
+  '';
+
+  patches = [ ./fix-udevmon-configuration-job-path.patch ];
+
+  meta = {
+    description = "A minimal composable infrastructure on top of libudev and libevdev";
+    homepage = "https://gitlab.com/interception/linux/tools";
+    license = stdenv.lib.licenses.gpl3;
+    maintainers = [ stdenv.lib.maintainers.vyp ];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/inputmethods/interception-tools/fix-udevmon-configuration-job-path.patch b/nixpkgs/pkgs/tools/inputmethods/interception-tools/fix-udevmon-configuration-job-path.patch
new file mode 100644
index 000000000000..469c96647d69
--- /dev/null
+++ b/nixpkgs/pkgs/tools/inputmethods/interception-tools/fix-udevmon-configuration-job-path.patch
@@ -0,0 +1,32 @@
+From d3a5d661b80f3597368f517ebaeddfdfaafc1bf2 Mon Sep 17 00:00:00 2001
+From: xd1le <elisp.vim@gmail.com>
+Date: Mon, 28 Aug 2017 00:19:09 +1000
+Subject: [PATCH] fix udevmon configuration job path
+
+For some reason, the udevmon job $PATH seems to be empty (or otherwise
+seems to point to `/no-such-path`). This commit fixes that by setting
+its $PATH to the same $PATH that the parent udevmon process has.
+---
+ udevmon.cpp | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/udevmon.cpp b/udevmon.cpp
+index ebdd909..b523efd 100644
+--- a/udevmon.cpp
++++ b/udevmon.cpp
+@@ -237,8 +237,11 @@ private:
+             case 0: {
+                 char *command[] = {(char *)"sh", (char *)"-c",
+                                    (char *)job.c_str(), nullptr};
++                std::string path = getenv("PATH");
+                 std::string variables = "DEVNODE=" + devnode;
+-                char *environment[]   = {(char *)variables.c_str(), nullptr};
++                std::string pathenv = "PATH=" + path;
++                char *environment[] = {(char *)variables.c_str(),
++                                       (char *)pathenv.c_str(), nullptr};
+                 execvpe(command[0], command, environment);
+                 std::fprintf(stderr,
+                              R"(exec failed for devnode %s, job "%s" )"
+-- 
+2.14.1
+