From 0757f23c4eb7ebd6cd48af14872ad2d2857ba8c4 Mon Sep 17 00:00:00 2001
From: Jens Nolte <git@queezle.net>
Date: Sat, 30 Oct 2021 01:14:39 +0200
Subject: [PATCH] Add some udev rules and device configs

---
 layers/nfc.nix | 17 +++++++++++++++++
 layers/tv.nix  | 12 ++++++++++++
 2 files changed, 29 insertions(+)
 create mode 100644 layers/nfc.nix
 create mode 100644 layers/tv.nix

diff --git a/layers/nfc.nix b/layers/nfc.nix
new file mode 100644
index 0000000..207c9af
--- /dev/null
+++ b/layers/nfc.nix
@@ -0,0 +1,17 @@
+{ config, pkgs, lib, ... }:
+with lib;
+
+{
+  services.udev.packages = singleton (pkgs.writeTextFile {
+    name = "nfc-uart-udev-rules";
+    destination = "/etc/udev/rules.d/90-nfc-uart.rules";
+    text = ''
+      SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", GROUP="dialout", SYMLINK+="nfc-uart"
+    '';
+  });
+
+  environment.etc."nfc/libnfc.conf".text = ''
+    device.name = "PN532 board via UART"
+    device.connstring = pn532_uart:/dev/nfc-uart
+  '';
+}
diff --git a/layers/tv.nix b/layers/tv.nix
new file mode 100644
index 0000000..0fd2aec
--- /dev/null
+++ b/layers/tv.nix
@@ -0,0 +1,12 @@
+{ pkgs, lib, ... }:
+with lib;
+
+{
+  services.udev.packages = singleton (pkgs.writeTextFile {
+    name = "tv-serial-udev-rules";
+    destination = "/etc/udev/rules.d/90-tv-serial.rules";
+    text = ''
+      SUBSYSTEM=="tty", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", SYMLINK+="tv-serial"
+    '';
+  });
+}
-- 
GitLab