diff --git a/nixos/modules/hardware/wooting.nix b/nixos/modules/hardware/wooting.nix new file mode 100644 index 000000000000..ee550cbbf6b8 --- /dev/null +++ b/nixos/modules/hardware/wooting.nix @@ -0,0 +1,12 @@ +{ config, lib, pkgs, ... }: + +with lib; +{ + options.hardware.wooting.enable = + mkEnableOption "Enable support for Wooting keyboards"; + + config = mkIf config.hardware.wooting.enable { + environment.systemPackages = [ pkgs.wootility ]; + services.udev.packages = [ pkgs.wooting-udev-rules ]; + }; +} diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 1ff5f5ff0c25..ccdc39eecd8d 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -64,6 +64,7 @@ ./hardware/tuxedo-keyboard.nix ./hardware/usb-wwan.nix ./hardware/onlykey.nix + ./hardware/wooting.nix ./hardware/video/amdgpu.nix ./hardware/video/amdgpu-pro.nix ./hardware/video/ati.nix diff --git a/pkgs/os-specific/linux/wooting-udev-rules/default.nix b/pkgs/os-specific/linux/wooting-udev-rules/default.nix new file mode 100644 index 000000000000..49da843e3ad9 --- /dev/null +++ b/pkgs/os-specific/linux/wooting-udev-rules/default.nix @@ -0,0 +1,23 @@ +{ stdenv }: + +stdenv.mkDerivation rec { + pname = "wooting-udev-rules"; + version = "20190601"; + + # Source: https://wooting.helpscoutdocs.com/article/68-wootility-configuring-device-access-for-wootility-under-linux-udev-rules + src = [ ./wooting.rules ]; + + unpackPhase = ":"; + + installPhase = '' + install -Dpm644 $src $out/lib/udev/rules.d/70-wooting.rules + ''; + + meta = with stdenv.lib; { + homepage = https://wooting.helpscoutdocs.com/article/34-linux-udev-rules; + description = "udev rules that give NixOS permission to communicate with Wooting keyboards"; + platforms = platforms.linux; + license = "unknown"; + maintainers = with maintainers; [ davidtwco ]; + }; +} diff --git a/pkgs/os-specific/linux/wooting-udev-rules/wooting.rules b/pkgs/os-specific/linux/wooting-udev-rules/wooting.rules new file mode 100644 index 000000000000..d906df3d4c6a --- /dev/null +++ b/pkgs/os-specific/linux/wooting-udev-rules/wooting.rules @@ -0,0 +1,9 @@ +# Wooting One +SUBSYSTEM=="hidraw", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="ff01", MODE:="0660", GROUP="input" +# Wooting One update mode +SUBSYSTEM=="hidraw", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2402", MODE:="0660", GROUP="input" + +# Wooting Two +SUBSYSTEM=="hidraw", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="ff02", MODE:="0660", GROUP="input" +# Wooting Two update mode +SUBSYSTEM=="hidraw", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2403", MODE:="0660", GROUP="input" diff --git a/pkgs/tools/misc/wootility/default.nix b/pkgs/tools/misc/wootility/default.nix new file mode 100644 index 000000000000..e88322f7f756 --- /dev/null +++ b/pkgs/tools/misc/wootility/default.nix @@ -0,0 +1,32 @@ +{ appimageTools, fetchurl, lib, gsettings-desktop-schemas, gtk3, udev, wooting-udev-rules }: + +let + pname = "wootility"; + version = "3.3.3"; +in +appimageTools.wrapType2 rec { + name = "${pname}-${version}"; + + src = fetchurl { + url = "https://s3.eu-west-2.amazonaws.com/wooting-update/wootility-linux-latest/wootility-${version}.AppImage"; + sha256 = "1qdiacwnvqahqkrhwnblz0jjywn63c6ndl3z450myhx5x55fdcja"; + }; + + profile = '' + export LC_ALL=C.UTF-8 + export XDG_DATA_DIRS="${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}:${gtk3}/share/gsettings-schemas/${gtk3.name}:$XDG_DATA_DIRS" + ''; + + multiPkgs = extraPkgs; + extraPkgs = + pkgs: (appimageTools.defaultFhsEnvArgs.multiPkgs pkgs) ++ ([ udev wooting-udev-rules ]); + extraInstallCommands = "mv $out/bin/{${name},${pname}}"; + + meta = with lib; { + homepage = https://wooting.io/wootility; + description = "Wootility is customization and management software for Wooting keyboards."; + platforms = [ "x86_64-linux" ]; + license = "unknown"; + maintainers = with maintainers; [ davidtwco ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 52ab6074b37c..de72eeb19ba0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7299,6 +7299,8 @@ in woof = callPackage ../tools/misc/woof { }; + wootility = callPackage ../tools/misc/wootility { }; + wpscan = callPackage ../tools/security/wpscan { }; wsmancli = callPackage ../tools/system/wsmancli {}; @@ -17468,6 +17470,8 @@ in wirelesstools = callPackage ../os-specific/linux/wireless-tools { }; + wooting-udev-rules = callPackage ../os-specific/linux/wooting-udev-rules { }; + wpa_supplicant = callPackage ../os-specific/linux/wpa_supplicant { }; wpa_supplicant_gui = libsForQt5.callPackage ../os-specific/linux/wpa_supplicant/gui.nix { };