final: prev: { uhk-agent = let version = "1.5.15"; 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-t2Jwd/x0eTZ4xBaCb/FomH/zSRLt7IIERUF9n9ONCpE="; }; 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 ''; }