refactor: use uhk-agent and udev rules from nixpkgs

feat/email
Benjamin Bädorf 2023-10-15 22:33:50 +02:00
parent d1baf5035f
commit 1e5c33e750
No known key found for this signature in database
GPG Key ID: 4406E80E13CD656C
7 changed files with 6 additions and 74 deletions

View File

@ -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 = ''

View File

@ -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
];
};

View File

@ -22,7 +22,6 @@
office = import ./office;
printing = import ./printing;
terminal-life = import ./terminal-life;
uhk = import ./uhk;
user = import ./user;
virtualisation = import ./virtualisation;

View File

@ -11,6 +11,8 @@
"steam-run"
"hplip"
"cups-brother-hl3140cw"
"uhk-agent"
"uhk-udev-rules"
];
nix = {

View File

@ -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"
'';
}

View File

@ -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);

View File

@ -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
'';
}