From 9717fb7b59f3b371a068519e78596b71b1adb050 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 11 Sep 2020 15:27:01 +0800 Subject: [PATCH] nixops: share extra udev rules --- nixops/desktop.nix | 27 +-------------------------- nixops/extra-udev.nix | 26 ++++++++++++++++++++++++++ nixops/rpi.nix | 1 + 3 files changed, 28 insertions(+), 26 deletions(-) create mode 100644 nixops/extra-udev.nix diff --git a/nixops/desktop.nix b/nixops/desktop.nix index 38378eb5..9149f38d 100644 --- a/nixops/desktop.nix +++ b/nixops/desktop.nix @@ -126,32 +126,7 @@ in users.extraUsers = import ./common-users.nix { inherit pkgs; }; security.sudo.wheelNeedsPassword = false; services.udev.packages = [ m-labs.openocd ]; - services.udev.extraRules = '' -# leaf maple -SUBSYSTEM=="usb", ATTRS{idVendor}=="1eaf", ATTRS{idProduct}=="0003", MODE="0660", GROUP="plugdev" -SUBSYSTEM=="usb", ATTRS{idVendor}=="1eaf", ATTRS{idProduct}=="0004", MODE="0660", GROUP="plugdev" -# STM32 devkit -SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374e", MODE="0660", GROUP="plugdev" -# glasgow -SUBSYSTEM=="usb", ATTRS{idVendor}=="20b7", ATTRS{idProduct}=="9db1", MODE="0660", GROUP="plugdev" -# hackrf -SUBSYSTEM=="usb", ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="6089", MODE="0660", GROUP="plugdev" -# bladerf -SUBSYSTEM=="usb", ATTRS{idVendor}=="2cf0", ATTRS{idProduct}=="5250", MODE="0660", GROUP="plugdev" -# personal measurement device -SUBSYSTEM=="usb", ATTRS{idVendor}=="09db", ATTRS{idProduct}=="007a", MODE="0660", GROUP="plugdev" -# saleae -SUBSYSTEM=="usb", ATTRS{idVendor}=="0925", ATTRS{idProduct}=="3881", MODE="0660", GROUP="plugdev" -# ocean optics -SUBSYSTEM=="usb", ATTRS{idVendor}=="2457", ATTRS{idProduct}=="1002", MODE="0660", GROUP="plugdev" -# yubikey -SUBSYSTEM=="usb", ATTRS{idVendor}=="1050", ATTRS{idProduct}=="0116", MODE="0660", GROUP="plugdev" -# dfu/booster -SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="0660", GROUP="plugdev" -# Renkforce USB hub with power control -SUBSYSTEM=="usb", ATTRS{idVendor}=="2109", ATTRS{idProduct}=="0812", MODE="0660", GROUP="plugdev" -SUBSYSTEM=="usb", ATTRS{idVendor}=="2109", ATTRS{idProduct}=="2812", MODE="0660", GROUP="plugdev" - ''; + services.udev.extraRules = (import ./extra-udev.nix); nix.binaryCachePublicKeys = ["nixbld.m-labs.hk-1:5aSRVA5b320xbNvu30tqxVPXpld73bhtOeH6uAjRyHc="]; nix.binaryCaches = ["https://nixbld.m-labs.hk" "https://cache.nixos.org"]; diff --git a/nixops/extra-udev.nix b/nixops/extra-udev.nix new file mode 100644 index 00000000..ee6a5c72 --- /dev/null +++ b/nixops/extra-udev.nix @@ -0,0 +1,26 @@ +'' +# leaf maple +SUBSYSTEM=="usb", ATTRS{idVendor}=="1eaf", ATTRS{idProduct}=="0003", MODE="0660", GROUP="plugdev" +SUBSYSTEM=="usb", ATTRS{idVendor}=="1eaf", ATTRS{idProduct}=="0004", MODE="0660", GROUP="plugdev" +# STM32 devkit +SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374e", MODE="0660", GROUP="plugdev" +# glasgow +SUBSYSTEM=="usb", ATTRS{idVendor}=="20b7", ATTRS{idProduct}=="9db1", MODE="0660", GROUP="plugdev" +# hackrf +SUBSYSTEM=="usb", ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="6089", MODE="0660", GROUP="plugdev" +# bladerf +SUBSYSTEM=="usb", ATTRS{idVendor}=="2cf0", ATTRS{idProduct}=="5250", MODE="0660", GROUP="plugdev" +# personal measurement device +SUBSYSTEM=="usb", ATTRS{idVendor}=="09db", ATTRS{idProduct}=="007a", MODE="0660", GROUP="plugdev" +# saleae +SUBSYSTEM=="usb", ATTRS{idVendor}=="0925", ATTRS{idProduct}=="3881", MODE="0660", GROUP="plugdev" +# ocean optics +SUBSYSTEM=="usb", ATTRS{idVendor}=="2457", ATTRS{idProduct}=="1002", MODE="0660", GROUP="plugdev" +# yubikey +SUBSYSTEM=="usb", ATTRS{idVendor}=="1050", ATTRS{idProduct}=="0116", MODE="0660", GROUP="plugdev" +# dfu/booster +SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="0660", GROUP="plugdev" +# Renkforce USB hub with power control +SUBSYSTEM=="usb", ATTRS{idVendor}=="2109", ATTRS{idProduct}=="0812", MODE="0660", GROUP="plugdev" +SUBSYSTEM=="usb", ATTRS{idVendor}=="2109", ATTRS{idProduct}=="2812", MODE="0660", GROUP="plugdev" +'' diff --git a/nixops/rpi.nix b/nixops/rpi.nix index 9a2aea39..6b93c296 100644 --- a/nixops/rpi.nix +++ b/nixops/rpi.nix @@ -55,6 +55,7 @@ in }; security.sudo.wheelNeedsPassword = false; services.udev.packages = [ m-labs.openocd ]; + services.udev.extraRules = (import ./extra-udev.nix); documentation.enable = false; environment.systemPackages = with pkgs; [