From 1e5c33e7502bb41b522e8f13b1ca4d6451d933ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20B=C3=A4dorf?= Date: Sun, 15 Oct 2023 22:33:50 +0200 Subject: [PATCH] refactor: use uhk-agent and udev rules from nixpkgs --- hosts/chocolatebar/configuration.nix | 5 +++- hosts/default.nix | 2 -- modules/default.nix | 1 - modules/nix/default.nix | 2 ++ modules/uhk/default.nix | 25 ---------------- pkgs/default.nix | 1 - pkgs/uhk-agent.nix | 44 ---------------------------- 7 files changed, 6 insertions(+), 74 deletions(-) delete mode 100644 modules/uhk/default.nix delete mode 100644 pkgs/uhk-agent.nix diff --git a/hosts/chocolatebar/configuration.nix b/hosts/chocolatebar/configuration.nix index a30b525..e3c493c 100644 --- a/hosts/chocolatebar/configuration.nix +++ b/hosts/chocolatebar/configuration.nix @@ -15,6 +15,8 @@ in { rocm-opencl-runtime ]; + hardware.keyboard.uhk.enable = true; + # Use the systemd-boot EFI boot loader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; @@ -31,7 +33,8 @@ in { environment.systemPackages = with pkgs; [ drone-docker-runner stdenv.cc.cc.lib - pkgs.hplip + hplip + uhk-agent ]; services.udev.extraRules = '' diff --git a/hosts/default.nix b/hosts/default.nix index bf25950..9d34ea1 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -17,7 +17,6 @@ self.nixosModules.nextcloud self.nixosModules.office self.nixosModules.printing - self.nixosModules.uhk ]; }; @@ -37,7 +36,6 @@ self.nixosModules.nextcloud self.nixosModules.office self.nixosModules.printing - self.nixosModules.uhk self.nixosModules.virtualisation ]; }; diff --git a/modules/default.nix b/modules/default.nix index 5fe7282..b5cc1e3 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -22,7 +22,6 @@ office = import ./office; printing = import ./printing; terminal-life = import ./terminal-life; - uhk = import ./uhk; user = import ./user; virtualisation = import ./virtualisation; diff --git a/modules/nix/default.nix b/modules/nix/default.nix index 5482e12..89464f2 100644 --- a/modules/nix/default.nix +++ b/modules/nix/default.nix @@ -11,6 +11,8 @@ "steam-run" "hplip" "cups-brother-hl3140cw" + "uhk-agent" + "uhk-udev-rules" ]; nix = { diff --git a/modules/uhk/default.nix b/modules/uhk/default.nix deleted file mode 100644 index fdc46d6..0000000 --- a/modules/uhk/default.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - lib, - config, - pkgs, - ... -}: -with lib; let - psCfg = config.pub-solar; -in { - users.users."${psCfg.user.name}".packages = with pkgs; [ - uhk-agent - ]; - - # Ultimate Hacking Keyboard rules - # These are the udev rules for accessing the USB interfaces of the UHK as non-root users. - services.udev.packages = with pkgs; [ - uhk-agent - ]; - - services.udev.extraRules = '' - SUBSYSTEM=="input", ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="612[0-7]", GROUP="input", MODE="0660" - SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="612[0-7]", TAG+="uaccess" - KERNEL=="hidraw*", ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="612[0-7]", TAG+="uaccess" - ''; -} diff --git a/pkgs/default.nix b/pkgs/default.nix index 12dbdc1..c4231e9 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -16,7 +16,6 @@ with prev; { sway-launcher = writeScriptBin "sway-launcher" (import ./sway-launcher.nix final); sway-service = writeShellScriptBin "sway-service" (import ./sway-service.nix final); toggle-kbd-layout = writeShellScriptBin "toggle-kbd-layout" (import ./toggle-kbd-layout.nix final); - uhk-agent = import ./uhk-agent.nix final; wcwd = writeShellScriptBin "wcwd" (import ./wcwd.nix final); drone-docker-runner = writeShellScriptBin "drone-docker-runner" (import ./drone-docker-runner.nix final); record-screen = writeShellScriptBin "record-screen" (import ./record-screen.nix final); diff --git a/pkgs/uhk-agent.nix b/pkgs/uhk-agent.nix deleted file mode 100644 index 1293fc4..0000000 --- a/pkgs/uhk-agent.nix +++ /dev/null @@ -1,44 +0,0 @@ -self: -with self; let - uhk-agent-bin = stdenv.mkDerivation rec { - pname = "uhk-agent-bin"; - version = "1.5.14"; - src = builtins.fetchurl { - url = "https://github.com/UltimateHackingKeyboard/agent/releases/download/v1.5.14/UHK.Agent-1.5.14-linux-x86_64.AppImage"; - sha256 = "sha256:1yzh4ixy0cqg02xf84vcqj3h67mkxyzs6jf1h935ay582n70nyqg"; - }; - phases = ["installPhase" "patchPhase"]; - installPhase = '' - mkdir -p $out/bin - cp $src $out/bin/uhk-agent - chmod +x $out/bin/uhk-agent - ''; - }; - - script = '' - #!${bash}/bin/bash - - ${appimage-run}/bin/appimage-run ${uhk-agent-bin}/bin/uhk-agent - ''; -in - stdenv.mkDerivation rec { - pname = "uhk-agent"; - version = "1.5.14"; - buildInputs = [ - bash - uhk-agent-bin - appimage-run - ]; - - phases = ["buildPhase" "installPhase" "patchPhase"]; - - buildPhase = '' - echo "${script}" >> uhk-agent - ''; - - installPhase = '' - mkdir -p $out/bin - cp uhk-agent $out/bin/uhk-agent - chmod +x $out/bin/uhk-agent - ''; - }