summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hosts/sif/default.nix2
-rw-r--r--overlays/uhk-agent.nix41
2 files changed, 42 insertions, 1 deletions
diff --git a/hosts/sif/default.nix b/hosts/sif/default.nix
index af845bc1..c1bae599 100644
--- a/hosts/sif/default.nix
+++ b/hosts/sif/default.nix
@@ -115,7 +115,7 @@
115 }; 115 };
116 116
117 environment.systemPackages = with pkgs; [ 117 environment.systemPackages = with pkgs; [
118 nvtop brightnessctl config.boot.kernelPackages.v4l2loopback s-tui 118 nvtop brightnessctl config.boot.kernelPackages.v4l2loopback s-tui uhk-agent
119 ]; 119 ];
120 120
121 services = { 121 services = {
diff --git a/overlays/uhk-agent.nix b/overlays/uhk-agent.nix
new file mode 100644
index 00000000..3110c835
--- /dev/null
+++ b/overlays/uhk-agent.nix
@@ -0,0 +1,41 @@
1final: prev:
2{
3 uhk-agent =
4 let
5 version = "1.5.14";
6
7 image = prev.stdenv.mkDerivation {
8 name = "uhk-agent-image";
9 src = prev.fetchurl {
10 url = "https://github.com/UltimateHackingKeyboard/agent/releases/download/v${version}/UHK.Agent-${version}-linux-x86_64.AppImage";
11 hash = "sha256-D3sLjhWoeFVGgsFJo7/vsx4Dh8RsE+S6AA8z4Hsk8Ps=";
12 };
13 buildCommand = ''
14 install -m 0644 $src $out
15 '';
16 };
17
18 appimage-run' = prev.appimage-run.override {
19 extraPkgs = p: with p; [
20 at-spi2-core
21 ];
22 };
23
24 runScript = prev.writeShellScript "run-uhk-agent" ''
25 exec -- ${appimage-run'}/bin/appimage-run ${image}
26 '';
27
28 udevRules = prev.writeText "uhk60.rules" ''
29 # Ultimate Hacking Keyboard rules
30 # These are the udev rules for accessing the USB interfaces of the UHK as non-root users.
31 # Copy this file to /etc/udev/rules.d and physically reconnect the UHK afterwards.
32 SUBSYSTEM=="input", GROUP="input", MODE="0664"
33 SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="612[0-7]", MODE:="0664", GROUP="plugdev"
34 KERNEL=="hidraw*", ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="612[0-7]", MODE:="0664", GROUP="plugdev"
35 '';
36 in prev.runCommand "uhk-agent" {} ''
37 mkdir -p $out/bin $out/etc/udev/rules.d
38 install -m 0755 ${runScript} $out/bin/uhk-agent
39 install -m 0644 ${udevRules} $out/etc/udev/rules.d/50-uhk60.rules
40 '';
41}