UHK-agent: Support for Ultimate Hacking Keyboard udev-rules and configuration application (#132420)

* maintainers: add ngiger

* uhk-agent: init at 1.5.17

* Apply suggestions from code review

* Update pkgs/os-specific/linux/uhk-agent/default.nix

* Apply suggestions from code review

* Update pkgs/os-specific/linux/uhk-agent/default.nix

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>

authored by Niklaus Giger Sandro and committed by GitHub 1d82f62a 2f677eae

+91
+6
maintainers/maintainer-list.nix
··· 9026 9026 email = "nfjinjing@gmail.com"; 9027 9027 name = "Jinjing Wang"; 9028 9028 }; 9029 + ngiger = { 9030 + email = "niklaus.giger@member.fsf.org"; 9031 + github = "ngiger"; 9032 + githubId = 265800; 9033 + name = "Niklaus Giger"; 9034 + }; 9029 9035 nh2 = { 9030 9036 email = "mail@nh2.me"; 9031 9037 matrix = "@nh2:matrix.org";
+21
nixos/modules/hardware/keyboard/uhk.nix
··· 1 + { config, lib, pkgs, ... }: 2 + 3 + with lib; 4 + let 5 + cfg = config.hardware.keyboard.uhk; 6 + in 7 + { 8 + options.hardware.keyboard.uhk = { 9 + enable = mkEnableOption '' 10 + non-root access to the firmware of UHK keyboards. 11 + You need it when you want to flash a new firmware on the keyboard. 12 + Access to the keyboard is granted to users in the "input" group. 13 + You may want to install the uhk-agent package. 14 + ''; 15 + 16 + }; 17 + 18 + config = mkIf cfg.enable { 19 + services.udev.packages = [ pkgs.uhk-udev-rules ]; 20 + }; 21 + }
+1
nixos/modules/module-list.nix
··· 57 57 ./hardware/sensor/hddtemp.nix 58 58 ./hardware/sensor/iio.nix 59 59 ./hardware/keyboard/teck.nix 60 + ./hardware/keyboard/uhk.nix 60 61 ./hardware/keyboard/zsa.nix 61 62 ./hardware/ksm.nix 62 63 ./hardware/ledger.nix
+39
pkgs/os-specific/linux/uhk-agent/default.nix
··· 1 + { appimageTools, lib, fetchurl, polkit, udev }: 2 + let 3 + pname = "uhk-agent"; 4 + version = "1.5.17"; 5 + src = fetchurl { 6 + url = "https://github.com/UltimateHackingKeyboard/agent/releases/download/v${version}/UHK.Agent-${version}-linux-x86_64.AppImage"; 7 + name = "${pname}-${version}.AppImage"; 8 + sha256 = "sha256-auOoTTRmkXVDDvcmRFzQIStNlbai8bTBLb/KUjk6EAc="; 9 + }; 10 + 11 + appimageContents = appimageTools.extract { 12 + name = "${pname}-${version}"; 13 + inherit src; 14 + }; 15 + in appimageTools.wrapType2 { 16 + inherit pname version src; 17 + 18 + extraPkgs = pkgs: with pkgs; [ polkit udev ]; 19 + 20 + extraInstallCommands = '' 21 + mv $out/bin/${pname}-${version} $out/bin/${pname} 22 + 23 + install -m 444 -D ${appimageContents}/${pname}.desktop -t $out/share/applications 24 + install -m 644 -D ${appimageContents}/resources/rules/50-uhk60.rules $out/rules/50-uhk60.rules 25 + substituteInPlace $out/share/applications/${pname}.desktop \ 26 + --replace 'Exec=AppRun' 'Exec=${pname}' 27 + cp -r ${appimageContents}/usr/share/icons $out/share 28 + ''; 29 + # wrapType2 does not passthru pname+version 30 + passthru.version = version; 31 + 32 + meta = with lib; { 33 + description = "Agent is the configuration application of the Ultimate Hacking Keyboard"; 34 + homepage = "https://github.com/UltimateHackingKeyboard/agent"; 35 + license = licenses.unfreeRedistributable; 36 + maintainers = with maintainers; [ ngiger ]; 37 + platforms = [ "x86_64-linux" ]; 38 + }; 39 + }
+20
pkgs/os-specific/linux/uhk-udev-rules/default.nix
··· 1 + { lib, stdenv, uhk-agent }: 2 + 3 + stdenv.mkDerivation { 4 + pname = "uhk-udev-rules"; 5 + inherit (uhk-agent) version; 6 + 7 + dontUnpack = true; 8 + dontBuild = true; 9 + installPhase = '' 10 + runHook preInstall 11 + install -D -m 644 ${uhk-agent.out}/rules/50-uhk60.rules $out/lib/udev/rules.d/50-uhk60.rules 12 + runHook postInstall 13 + ''; 14 + 15 + meta = { 16 + description = "udev rules for UHK keyboards from https://ultimatehackingkeyboard.com"; 17 + inherit (uhk-agent.meta) license; 18 + maintainers = [ lib.maintainers.ngiger ]; 19 + }; 20 + }
+4
pkgs/top-level/all-packages.nix
··· 11147 11147 11148 11148 ugrep = callPackage ../tools/text/ugrep { }; 11149 11149 11150 + uhk-agent = callPackage ../os-specific/linux/uhk-agent { }; 11151 + 11152 + uhk-udev-rules = callPackage ../os-specific/linux/uhk-udev-rules { }; 11153 + 11150 11154 uif2iso = callPackage ../tools/cd-dvd/uif2iso { }; 11151 11155 11152 11156 uivonim = callPackage ../applications/editors/uivonim { };