From 6c50c69d97dc86d930fcbee3ee3b95178dcebdd9 Mon Sep 17 00:00:00 2001 From: "Wael M. Nasreddine" Date: Fri, 28 May 2021 16:28:38 -0700 Subject: config.hardware.onlykey: move the module into its own folder (cherry picked from commit 1f9e0192603f335e2bf29e7bb2a67acd5c4cb3c9) --- nixos/modules/hardware/onlykey.nix | 33 ----------------------------- nixos/modules/hardware/onlykey.udev | 4 ---- nixos/modules/hardware/onlykey/default.nix | 33 +++++++++++++++++++++++++++++ nixos/modules/hardware/onlykey/onlykey.udev | 4 ++++ nixos/modules/module-list.nix | 2 +- 5 files changed, 38 insertions(+), 38 deletions(-) delete mode 100644 nixos/modules/hardware/onlykey.nix delete mode 100644 nixos/modules/hardware/onlykey.udev create mode 100644 nixos/modules/hardware/onlykey/default.nix create mode 100644 nixos/modules/hardware/onlykey/onlykey.udev diff --git a/nixos/modules/hardware/onlykey.nix b/nixos/modules/hardware/onlykey.nix deleted file mode 100644 index 07358c8a8782..000000000000 --- a/nixos/modules/hardware/onlykey.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ config, lib, ... }: - -with lib; - -{ - - ####### interface - - options = { - - hardware.onlykey = { - enable = mkOption { - type = types.bool; - default = false; - description = '' - Enable OnlyKey device (https://crp.to/p/) support. - ''; - }; - }; - - }; - - ## As per OnlyKey's documentation piece (hhttps://docs.google.com/document/d/1Go_Rs218fKUx-j_JKhddbSVTqY6P0vQO831t2MKCJC8), - ## it is important to add udev rule for OnlyKey for it to work on Linux - - ####### implementation - - config = mkIf config.hardware.onlykey.enable { - services.udev.extraRules = builtins.readFile ./onlykey.udev; - }; - - -} diff --git a/nixos/modules/hardware/onlykey.udev b/nixos/modules/hardware/onlykey.udev deleted file mode 100644 index 6583530e5684..000000000000 --- a/nixos/modules/hardware/onlykey.udev +++ /dev/null @@ -1,4 +0,0 @@ -ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", ENV{ID_MM_DEVICE_IGNORE}="1" -ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789A]?", ENV{MTP_NO_PROBE}="1" -SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789ABCD]?", GROUP+="plugdev" -KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", GROUP+="plugdev" diff --git a/nixos/modules/hardware/onlykey/default.nix b/nixos/modules/hardware/onlykey/default.nix new file mode 100644 index 000000000000..07358c8a8782 --- /dev/null +++ b/nixos/modules/hardware/onlykey/default.nix @@ -0,0 +1,33 @@ +{ config, lib, ... }: + +with lib; + +{ + + ####### interface + + options = { + + hardware.onlykey = { + enable = mkOption { + type = types.bool; + default = false; + description = '' + Enable OnlyKey device (https://crp.to/p/) support. + ''; + }; + }; + + }; + + ## As per OnlyKey's documentation piece (hhttps://docs.google.com/document/d/1Go_Rs218fKUx-j_JKhddbSVTqY6P0vQO831t2MKCJC8), + ## it is important to add udev rule for OnlyKey for it to work on Linux + + ####### implementation + + config = mkIf config.hardware.onlykey.enable { + services.udev.extraRules = builtins.readFile ./onlykey.udev; + }; + + +} diff --git a/nixos/modules/hardware/onlykey/onlykey.udev b/nixos/modules/hardware/onlykey/onlykey.udev new file mode 100644 index 000000000000..6583530e5684 --- /dev/null +++ b/nixos/modules/hardware/onlykey/onlykey.udev @@ -0,0 +1,4 @@ +ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", ENV{ID_MM_DEVICE_IGNORE}="1" +ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789A]?", ENV{MTP_NO_PROBE}="1" +SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789ABCD]?", GROUP+="plugdev" +KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", GROUP+="plugdev" diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 7910e47ca0c9..6fdec6430968 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -70,7 +70,7 @@ ./hardware/tuxedo-keyboard.nix ./hardware/ubertooth.nix ./hardware/usb-wwan.nix - ./hardware/onlykey.nix + ./hardware/onlykey/default.nix ./hardware/opentabletdriver.nix ./hardware/sata.nix ./hardware/wooting.nix -- cgit v1.2.3 From dff77786cfbdca36d65820397d889b5be47095c2 Mon Sep 17 00:00:00 2001 From: "Wael M. Nasreddine" Date: Fri, 28 May 2021 16:38:53 -0700 Subject: config.hardware.onlykey: update the udev rules for onlykey The udev rules were updated upstream without an explanation as you can see in [this comment][commit]. [commit]: https://github.com/trustcrypto/trustcrypto.github.io/commit/0bcf928adaea559e75efa02ebd1040f0a15f611d (cherry picked from commit eab36fabf6168f8fdbb2b835ce3ab689b9902ab1) --- nixos/modules/hardware/onlykey/onlykey.udev | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/nixos/modules/hardware/onlykey/onlykey.udev b/nixos/modules/hardware/onlykey/onlykey.udev index 6583530e5684..61e3ee4e8828 100644 --- a/nixos/modules/hardware/onlykey/onlykey.udev +++ b/nixos/modules/hardware/onlykey/onlykey.udev @@ -1,3 +1,17 @@ +# UDEV Rules for OnlyKey, https://docs.crp.to/linux.html +ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="60fc", ENV{ID_MM_DEVICE_IGNORE}="1" +ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="60fc", ENV{MTP_NO_PROBE}="1" +SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="60fc", MODE:="0666" +KERNEL=="ttyACM*", ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="60fc", MODE:="0666" + + +# The udev rules were updated upstream without an explanation as you can +# see in [this comment][commit]. Assuming that hey have changed the +# idVendor/idProduct, I've kept the old values. +# TODO: Contact them upstream. +# +# [commit]: https://github.com/trustcrypto/trustcrypto.github.io/commit/0bcf928adaea559e75efa02ebd1040f0a15f611d +# ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789A]?", ENV{MTP_NO_PROBE}="1" SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789ABCD]?", GROUP+="plugdev" -- cgit v1.2.3