From 78e873009d1628562f71b452b4b4a79f315f69da Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 9 Jun 2021 15:27:27 +0200 Subject: sif: uhk-agent --- overlays/uhk-agent.nix | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 overlays/uhk-agent.nix (limited to 'overlays') 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 @@ +final: prev: +{ + uhk-agent = + let + version = "1.5.14"; + + image = prev.stdenv.mkDerivation { + name = "uhk-agent-image"; + src = prev.fetchurl { + url = "https://github.com/UltimateHackingKeyboard/agent/releases/download/v${version}/UHK.Agent-${version}-linux-x86_64.AppImage"; + hash = "sha256-D3sLjhWoeFVGgsFJo7/vsx4Dh8RsE+S6AA8z4Hsk8Ps="; + }; + buildCommand = '' + install -m 0644 $src $out + ''; + }; + + appimage-run' = prev.appimage-run.override { + extraPkgs = p: with p; [ + at-spi2-core + ]; + }; + + runScript = prev.writeShellScript "run-uhk-agent" '' + exec -- ${appimage-run'}/bin/appimage-run ${image} + ''; + + udevRules = prev.writeText "uhk60.rules" '' + # Ultimate Hacking Keyboard rules + # These are the udev rules for accessing the USB interfaces of the UHK as non-root users. + # Copy this file to /etc/udev/rules.d and physically reconnect the UHK afterwards. + SUBSYSTEM=="input", GROUP="input", MODE="0664" + SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="612[0-7]", MODE:="0664", GROUP="plugdev" + KERNEL=="hidraw*", ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="612[0-7]", MODE:="0664", GROUP="plugdev" + ''; + in prev.runCommand "uhk-agent" {} '' + mkdir -p $out/bin $out/etc/udev/rules.d + install -m 0755 ${runScript} $out/bin/uhk-agent + install -m 0644 ${udevRules} $out/etc/udev/rules.d/50-uhk60.rules + ''; +} -- cgit v1.2.3