diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 35616b4d212..e2d13c3b6b2 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -9026,6 +9026,12 @@ email = "nfjinjing@gmail.com"; name = "Jinjing Wang"; }; + ngiger = { + email = "niklaus.giger@member.fsf.org"; + github = "ngiger"; + githubId = 265800; + name = "Niklaus Giger"; + }; nh2 = { email = "mail@nh2.me"; matrix = "@nh2:matrix.org"; diff --git a/nixos/modules/hardware/keyboard/uhk.nix b/nixos/modules/hardware/keyboard/uhk.nix new file mode 100644 index 00000000000..bf2d739c3a9 --- /dev/null +++ b/nixos/modules/hardware/keyboard/uhk.nix @@ -0,0 +1,21 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + cfg = config.hardware.keyboard.uhk; +in +{ + options.hardware.keyboard.uhk = { + enable = mkEnableOption '' + non-root access to the firmware of UHK keyboards. + You need it when you want to flash a new firmware on the keyboard. + Access to the keyboard is granted to users in the "input" group. + You may want to install the uhk-agent package. + ''; + + }; + + config = mkIf cfg.enable { + services.udev.packages = [ pkgs.uhk-udev-rules ]; + }; +} diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index dc658db8e2e..b3efa5d5e6f 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -57,6 +57,7 @@ ./hardware/sensor/hddtemp.nix ./hardware/sensor/iio.nix ./hardware/keyboard/teck.nix + ./hardware/keyboard/uhk.nix ./hardware/keyboard/zsa.nix ./hardware/ksm.nix ./hardware/ledger.nix diff --git a/pkgs/os-specific/linux/uhk-agent/default.nix b/pkgs/os-specific/linux/uhk-agent/default.nix new file mode 100644 index 00000000000..688a743fa9c --- /dev/null +++ b/pkgs/os-specific/linux/uhk-agent/default.nix @@ -0,0 +1,39 @@ +{ appimageTools, lib, fetchurl, polkit, udev }: +let + pname = "uhk-agent"; + version = "1.5.17"; + src = fetchurl { + url = "https://github.com/UltimateHackingKeyboard/agent/releases/download/v${version}/UHK.Agent-${version}-linux-x86_64.AppImage"; + name = "${pname}-${version}.AppImage"; + sha256 = "sha256-auOoTTRmkXVDDvcmRFzQIStNlbai8bTBLb/KUjk6EAc="; + }; + + appimageContents = appimageTools.extract { + name = "${pname}-${version}"; + inherit src; + }; +in appimageTools.wrapType2 { + inherit pname version src; + + extraPkgs = pkgs: with pkgs; [ polkit udev ]; + + extraInstallCommands = '' + mv $out/bin/${pname}-${version} $out/bin/${pname} + + install -m 444 -D ${appimageContents}/${pname}.desktop -t $out/share/applications + install -m 644 -D ${appimageContents}/resources/rules/50-uhk60.rules $out/rules/50-uhk60.rules + substituteInPlace $out/share/applications/${pname}.desktop \ + --replace 'Exec=AppRun' 'Exec=${pname}' + cp -r ${appimageContents}/usr/share/icons $out/share + ''; + # wrapType2 does not passthru pname+version + passthru.version = version; + + meta = with lib; { + description = "Agent is the configuration application of the Ultimate Hacking Keyboard"; + homepage = "https://github.com/UltimateHackingKeyboard/agent"; + license = licenses.unfreeRedistributable; + maintainers = with maintainers; [ ngiger ]; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/pkgs/os-specific/linux/uhk-udev-rules/default.nix b/pkgs/os-specific/linux/uhk-udev-rules/default.nix new file mode 100644 index 00000000000..bcb7799731f --- /dev/null +++ b/pkgs/os-specific/linux/uhk-udev-rules/default.nix @@ -0,0 +1,20 @@ +{ lib, stdenv, uhk-agent }: + +stdenv.mkDerivation { + pname = "uhk-udev-rules"; + inherit (uhk-agent) version; + + dontUnpack = true; + dontBuild = true; + installPhase = '' + runHook preInstall + install -D -m 644 ${uhk-agent.out}/rules/50-uhk60.rules $out/lib/udev/rules.d/50-uhk60.rules + runHook postInstall + ''; + + meta = { + description = "udev rules for UHK keyboards from https://ultimatehackingkeyboard.com"; + inherit (uhk-agent.meta) license; + maintainers = [ lib.maintainers.ngiger ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index aeaca927106..e24c269bbc2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -11147,6 +11147,10 @@ with pkgs; ugrep = callPackage ../tools/text/ugrep { }; + uhk-agent = callPackage ../os-specific/linux/uhk-agent { }; + + uhk-udev-rules = callPackage ../os-specific/linux/uhk-udev-rules { }; + uif2iso = callPackage ../tools/cd-dvd/uif2iso { }; uivonim = callPackage ../applications/editors/uivonim { };