{ 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";
      }
    ];
  };
}