interception-tools: init at 0.1.1

The latest release of libyamlcpp in nixpkgs does not build because it
uses an older version of boost than the one in nixpkgs and therefore
expects a particular header file which does not exist in the latest
boost anymore. For this reason, a later (git) version of libyamlcpp is
used here (which actually doesn't even require boost).

The substituteInPlace in the prePatch phase is needed because libevdev
places its headers in non-standard places, meaning Nix cannot normally
find them. The `cut` command removes the first two "-I" characters from
the output of `pkg-config`. This needs to be in the prePatch phase
because otherwise Nix will patch these lines to `/var/empty`, meaning
you would have less specific replacement (in case other lines are also
patched to `/var/empty`).

I wrote the patch. (I believe it is NixOS specific.)
This commit is contained in:
xd1le
2017-09-02 16:17:53 +10:00
parent 96457d26dd
commit e0b44a09b8
6 changed files with 172 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
{ stdenv, fetchurl, cmake }:
let
version = "0.1.0";
pname = "interception-tools-caps2esc";
in stdenv.mkDerivation {
name = "${pname}-${version}";
src = fetchurl {
url = "https://gitlab.com/interception/linux/plugins/caps2esc/repository/v${version}/archive.tar.gz";
sha256 = "1fdxqp54gwsrm2c63168l256nfwdk4mvgr7nlwdv62wd3l7zzrg8";
};
buildInputs = [ cmake ];
meta = {
homepage = "https://gitlab.com/interception/linux/plugins/caps2esc";
description = "Transforming the most useless key ever into the most useful one";
license = stdenv.lib.licenses.mit;
maintainers = stdenv.lib.maintainers.vyp;
platforms = stdenv.lib.platforms.linux;
};
}

View File

@@ -0,0 +1,33 @@
{ stdenv, fetchurl, fetchFromGitHub, pkgconfig, cmake, libyamlcppWithoutBoost,
libevdev, libudev }:
let
version = "0.1.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 = "14g4pphvylqdb922va322z1pbp12ap753hcf7zf9sii1ikvif83j";
};
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ cmake libevdev libudev libyamlcppWithoutBoost ];
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;
};
}

View File

@@ -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