From 2c145edb2652c388d1cd5c5c33fbd55d9d5daace Mon Sep 17 00:00:00 2001 From: Erwin Boskma Date: Wed, 16 Oct 2024 08:53:46 +0200 Subject: [PATCH] base: Add NVIDIA Tegra udev rules --- machines/mimir/configuration.nix | 3 +++ modules/base/default.nix | 17 ++++++++++------- modules/base/nvidia/default.nix | 30 ++++++++++++++++++++++++++++++ modules/base/nvidia/nvidia.rules | 28 ++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+), 7 deletions(-) create mode 100644 modules/base/nvidia/default.nix create mode 100644 modules/base/nvidia/nvidia.rules diff --git a/machines/mimir/configuration.nix b/machines/mimir/configuration.nix index 05be29f..71a2247 100644 --- a/machines/mimir/configuration.nix +++ b/machines/mimir/configuration.nix @@ -38,6 +38,9 @@ base = { plymouth.enable = true; work = true; + udev-rules = { + nvidia = true; + }; }; desktop = { diff --git a/modules/base/default.nix b/modules/base/default.nix index 26f080b..538ff07 100644 --- a/modules/base/default.nix +++ b/modules/base/default.nix @@ -7,10 +7,11 @@ with lib; let cfg = config.eboskma.base; - qmkUdevRules = pkgs.callPackage ./qmk { }; - probersRules = pkgs.callPackage ./probe-rs { }; blink1Rules = pkgs.callPackage ./blink1-udev { }; + nvidiaRules = pkgs.callPackage ./nvidia { }; picotoolRules = pkgs.callPackage ./picotool { }; + probersRules = pkgs.callPackage ./probe-rs { }; + qmkUdevRules = pkgs.callPackage ./qmk { }; solo2Rules = pkgs.callPackage ./solo2 { }; plymouth-nixos-blur = pkgs.callPackage ./plymouth-nixos-blur { }; in @@ -27,10 +28,11 @@ in }; udev-rules = { - qmk = mkEnableOption "qmk udev rules"; - probe-rs = mkEnableOption "probe.rs udev rules"; blink1 = mkEnableOption "blink(1) udev rules"; + nvidia = mkEnableOption "NVIDIA Tegra udev rules"; picotool = mkEnableOption "picotool udev rules"; + probe-rs = mkEnableOption "probe.rs udev rules"; + qmk = mkEnableOption "qmk udev rules"; solo2 = mkEnableOption "solo2 udev rules"; }; }; @@ -83,10 +85,11 @@ in services.udev = { packages = - (optional cfg.udev-rules.qmk qmkUdevRules) - ++ (optional cfg.udev-rules.probe-rs probersRules) - ++ (optional cfg.udev-rules.blink1 blink1Rules) + (optional cfg.udev-rules.blink1 blink1Rules) + ++ (optional cfg.udev-rules.nvidia nvidiaRules) ++ (optional cfg.udev-rules.picotool picotoolRules) + ++ (optional cfg.udev-rules.probe-rs probersRules) + ++ (optional cfg.udev-rules.qmk qmkUdevRules) ++ (optional cfg.udev-rules.solo2 solo2Rules); }; diff --git a/modules/base/nvidia/default.nix b/modules/base/nvidia/default.nix new file mode 100644 index 0000000..1b1c755 --- /dev/null +++ b/modules/base/nvidia/default.nix @@ -0,0 +1,30 @@ +{ lib, stdenv }: +let + pname = "nvidia-tegra-udev-rules"; + version = "20241015"; +in +stdenv.mkDerivation { + inherit pname version; + + src = ./.; + + phases = [ "installPhase" ]; + + installPhase = '' + install -D $src/nvidia.rules $out/lib/udev/rules.d/90-oe4t.rules + ''; + + meta = with lib; { + description = "udev rules for NVIDIA Tegra boards"; + homepage = "https://github.com/OE4T/meta-tegra/wiki/Flashing-the-Jetson-Dev-Kit#avoiding-sudo"; + license = licenses.mit; + platforms = platforms.linux; + maintainers = [ + { + email = "erwin@datarift.nl"; + github = "eboskma"; + name = "Erwin Boskma"; + } + ]; + }; +} diff --git a/modules/base/nvidia/nvidia.rules b/modules/base/nvidia/nvidia.rules new file mode 100644 index 0000000..f268b1f --- /dev/null +++ b/modules/base/nvidia/nvidia.rules @@ -0,0 +1,28 @@ +# Jetson TK1 +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7140", GROUP="adm" +# Jetson TX1 +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7721", GROUP="adm" +# Jetson TX2 +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7c18", GROUP="adm" +# Jetson TX2i +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7018", GROUP="adm" +# Jetson TX2-4GB +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7418", GROUP="adm" +# Jetson AGX Xavier +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7019", GROUP="adm" +# Jetson Xavier NX +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7e19", GROUP="adm" +# Jetson Nano +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7f21", GROUP="adm" +# Jetson Orin AGX (P3701-0000 Developer Kit module), (P3701-0005 with 64GB), (P3701-0008 with 64GB) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7023", GROUP="adm" +# Jetson Orin AGX (P3701-0004 with 32GB) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7223", GROUP="adm" +# Jetson Orin NX (P3767-0000 with 16GB) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7323", GROUP="adm" +# Jetson Orin NX (P3767-0001 with 8GB) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7423", GROUP="adm" +# Jetson Orin Nano (P3767-0003 and P3767-0005 with 8GB) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7523", GROUP="adm" +# Jetson Orin Nano (P3767-0004 with 4GB) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7623", GROUP="adm" \ No newline at end of file