-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
package request: keyd - "A key remapping daemon for linux" #132474
Comments
I tried making a rudimentary derivation but currently I don't have a lot of time to spend on this. It would be nice if someone more experienced could pick this up and turn it into a proper derivation. Notably the paths for the config file, log file and lock file should be made into options or be set to some standard nix paths. { lib, stdenv, fetchgit, udev, git }:
let
pname = "keyd";
version = "1.1.2";
in stdenv.mkDerivation rec {
inherit version pname;
src = fetchgit {
url = "https://github.com/rvaiya/keyd.git";
rev = "refs/tags/v${version}";
sha256 = "sha256-E9WHCJxTGwvkrwm4zXFye53nJU9GFtovIxRrpoL/VtM=";
};
buildInputs = [ git udev ];
patches = [
./keyd.patch
];
buildPhase = ''
make LOCK_FILE=/home/xxx/.keyd/keyd.lock LOG_FILE=/home/xxx/.keyd/keyd.log CONFIG_DIR=/home/xxx/.keyd
'';
installPhase = ''
make install DESTDIR=$out PREFIX=
'';
meta = {
description = "A key remapping daemon for linux.";
license = lib.licenses.mit;
platforms = lib.platforms.linux;
};
} The C source and Makefile had to be patched to allow for path customization, but this should probably be taken up with upstream. diff --git a/Makefile b/Makefile
index 8f90462..3563b80 100644
--- a/Makefile
+++ b/Makefile
@@ -3,9 +3,13 @@
DESTDIR=
PREFIX=/usr
+CONFIG_DIR=/etc/keyd
+LOCK_FILE=/var/lock/keyd.lock
+LOG_FILE=/var/log/keyd.log
+
VERSION=1.1.2
GIT_HASH=$(shell git describe --no-match --always --abbrev=40 --dirty)
-CFLAGS=-DVERSION=\"$(VERSION)\" -DGIT_COMMIT_HASH=\"$(GIT_HASH)\"
+CFLAGS=-DVERSION=\"$(VERSION)\" -DGIT_COMMIT_HASH=\"$(GIT_HASH)\" -DLOCK_FILE=\"$(LOCK_FILE)\" -DLOG_FILE=\"$(LOG_FILE)\" -DCONFIG_DIR=\"$(CONFIG_DIR)\"
all:
mkdir -p bin
diff --git a/src/config.h b/src/config.h
index a6465b8..3a53043 100644
--- a/src/config.h
+++ b/src/config.h
@@ -29,7 +29,11 @@
#include "keys.h"
#define MAX_LAYERS 32
+
+#ifndef CONFIG_DIR
#define CONFIG_DIR "/etc/keyd"
+#endif
+
#define MAX_LAYER_NAME_LEN 256
#define MAX_MACRO_SIZE 256
#define MAX_MACROS 256
diff --git a/src/main.c b/src/main.c
index 86dbc7e..a697170 100644
--- a/src/main.c
+++ b/src/main.c
@@ -42,8 +42,14 @@
#define UINPUT_DEVICE_NAME "keyd virtual keyboard"
#define MAX_KEYBOARDS 256
+
+#ifndef LOCK_FILE
#define LOCK_FILE "/var/lock/keyd.lock"
+#endif
+
+#ifndef LOG_FILE
#define LOG_FILE "/var/log/keyd.log" //Only used when running as a daemon.
+#endif
#ifdef DEBUG
#define dbg(fmt, ...) warn("%s:%d: "fmt, __FILE__, __LINE__, ## __VA_ARGS__) One can also define a systemd service for it (but I'm not using it that way so I haven't tested it). systemd.user.services."keyd" = {
Unit = {
Description = "key remapping daemon";
#Requires = "local-fs.target";
#After = "local-fs.target";
};
Service = {
Type = "simple";
ExecStart = "${pkgs.keyd}/bin/keyd";
};
}; |
I am new to Nix and was thinking of contributing to it by submitting this package. I am curious, @foolnotion, what is wrong with letting the config directories etc. stay that the way they are? Of course I would want more control over the dotfiles but that is an upstream issue, right? |
@dit7ya I am actually not sure about the proper "nix" way to package this, as nix does not strictly adhere to the FHS standard, but I thought it'd be nice to be able to configure the path. It seems more logical to me to keep the config files under |
I marked this as stale due to inactivity. → More info |
I've been carrying this locally for ages - apologies for not upstreaming it earlier. |
Project description
https://github.com/rvaiya/keyd
Metadata
The text was updated successfully, but these errors were encountered: