diff --git a/hosts/Shura/default.nix b/hosts/Shura/default.nix index b31f726..26b52dc 100644 --- a/hosts/Shura/default.nix +++ b/hosts/Shura/default.nix @@ -35,6 +35,8 @@ in tpm2.enable = true; }; + bluetooth.adapter = "AC:50:DE:9F:AB:88"; + # Change the default text editor. Options are "emacs", "nano", or "vim". editor = "nano"; diff --git a/modules/apps/bluetooth/vitrix-pdp-pro b/modules/apps/bluetooth/vitrix-pdp-pro new file mode 100644 index 0000000..25a32b9 --- /dev/null +++ b/modules/apps/bluetooth/vitrix-pdp-pro @@ -0,0 +1,42 @@ +[General] +Name=Victrix Pro BFG +Appearance=0x03c4 +AddressType=public +SupportedTechnologies=LE; +Trusted=true +Blocked=false +WakeAllowed=true +Services=00001800-0000-1000-8000-00805f9b34fb;00001801-0000-1000-8000-00805f9b34fb;0000180a-0000-1000-8000-00805f9b34fb;0000180f-0000-1000-8000-00805f9b34fb;00001812-0000-1000-8000-00805f9b34fb;00001813-0000-1000-8000-00805f9b34fb;f95a48e6-a721-11e9-a2a3-022ae2dbcce4; + +[LongTermKey] +Key=F12268049C72EA0561E2E77DEA02AC12 +Authenticated=0 +EncSize=16 +EDiv=29996 +Rand=5139827239406697411 + +[PeripheralLongTermKey] +Key=CC60B7A9080383302B61EC2127E0D5CD +Authenticated=0 +EncSize=16 +EDiv=59630 +Rand=6653202288716901387 + +[SlaveLongTermKey] +Key=CC60B7A9080383302B61EC2127E0D5CD +Authenticated=0 +EncSize=16 +EDiv=59630 +Rand=6653202288716901387 + +[DeviceID] +Source=2 +Vendor=3695 +Product=587 +Version=768 + +[ConnectionParameters] +MinInterval=6 +MaxInterval=6 +Latency=0 +Timeout=300 \ No newline at end of file diff --git a/modules/apps/gaming.nix b/modules/apps/gaming.nix index b2e804c..5250c3a 100644 --- a/modules/apps/gaming.nix +++ b/modules/apps/gaming.nix @@ -14,9 +14,12 @@ let sudo systemctl restart bluetooth.service ''; - # FIXME: replace with real vendorID and product ID for Victrix Pro BFG controller + # vendorID and product ID for Victrix Pro BFG controller vendorID = "0e6f"; productID = "024b"; + + # Bluetooth config for Victrix PDP pro + vitrix-pdp-pro-bluetooth = pkgs.writeText "info" (builtins.readFile ./bluetooth/vitrix-pdp-pro); in { options = { @@ -36,6 +39,11 @@ in # Enable Xbox controller driver (XPadNeo) hardware.xpadneo.enable = true; + systemd.tmpfiles.rules = lib.mkIf config.aux.system.bluetooth.enable [ + "d /var/lib/bluetooth/${config.aux.system.bluetooth.adapter}/ 0700 root root" # First, make sure the directory exists + "L+ /var/lib/bluetooth/${config.aux.system.bluetooth.adapter}/00:34:30:47:37:AB/info - - - - ${vitrix-pdp-pro-bluetooth}" + ]; + # Create udev rule to force PDP Victrix controller to use xpadneo # Udev rule taken from https://github.com/atar-axis/xpadneo/blob/master/hid-xpadneo/etc-udev-rules.d/60-xpadneo.rules # Also see https://www.reddit.com/r/linuxquestions/comments/rcx182/why_cant_i_write_to_sysbushiddriversxpadneonew_id/ diff --git a/modules/system/bluetooth.nix b/modules/system/bluetooth.nix index 6d17790..4638a8e 100644 --- a/modules/system/bluetooth.nix +++ b/modules/system/bluetooth.nix @@ -8,12 +8,20 @@ let cfg = config.aux.system.bluetooth; + + # Copy bluetooth device configs + shure-aonic-bluetooth = pkgs.writeText "info" (builtins.readFile ./bluetooth/shure-aonic-tw2); in { options = { aux.system.bluetooth = { enable = lib.mkEnableOption "Enables bluetooth."; + adapter = lib.mkOption { + type = lib.types.str; + description = "The MAC address of your primary Bluetooth adapter Used to install device configs."; + default = ""; + }; experimental.enable = lib.mkEnableOption "Enables experimental features, like device power reporting."; }; }; @@ -34,5 +42,11 @@ in # Add Bluetooth LE audio support environment.systemPackages = with pkgs; [ liblc3 ]; + + # Install Bluetooth device profiles + systemd.tmpfiles.rules = lib.mkIf (cfg.adapter != "") [ + "d /var/lib/bluetooth/${cfg.adapter}/ 0700 root root" # First, make sure the directory exists + "L+ /var/lib/bluetooth/${cfg.adapter}/00:0E:DD:72:2F:0C/info - - - - ${shure-aonic-bluetooth}" + ]; }; } diff --git a/modules/system/bluetooth/shure-aonic-tw2 b/modules/system/bluetooth/shure-aonic-tw2 new file mode 100644 index 0000000..ea210d2 --- /dev/null +++ b/modules/system/bluetooth/shure-aonic-tw2 @@ -0,0 +1,19 @@ +[General] +Name=Shure AONIC TW2 +Class=0x2c0404 +SupportedTechnologies=BR/EDR;LE; +Trusted=true +Blocked=false +Services=00001101-0000-1000-8000-00805f9b34fb;00001108-0000-1000-8000-00805f9b34fb;0000110a-0000-1000-8000-00805f9b34fb;0000110b-0000-1000-8000-00805f9b34fb;0000110c-0000-1000-8000-00805f9b34fb;0000110d-0000-1000-8000-00805f9b34fb;0000110e-0000-1000-8000-00805f9b34fb;0000111e-0000-1000-8000-00805f9b34fb;0000eb03-d102-11e1-9b23-00025b00a5a5;0000eb04-d102-11e1-9b23-00025b00a5a5;0000eb05-d102-11e1-9b23-00025b00a5a5; +AddressType=public + +[LinkKey] +Key=DFC42899B038D6C6B1296CF98DB0508A +Type=4 +PINLength=0 + +[ConnectionParameters] +MinInterval=24 +MaxInterval=40 +Latency=0 +Timeout=400 \ No newline at end of file diff --git a/modules/users/common/home-manager/gnome.nix b/modules/users/common/home-manager/gnome.nix index e9d98e1..0c002ea 100644 --- a/modules/users/common/home-manager/gnome.nix +++ b/modules/users/common/home-manager/gnome.nix @@ -1,5 +1,13 @@ { lib, osConfig, ... }: { + # NOTE: Allegedly prevents random Gnome crashes. But really, it just prevents me from logging in. + # See https://www.reddit.com/r/archlinux/comments/1erbika/fyi_if_you_experience_crashes_on_gnome_on_amd/ + /* + home.file.".config/environment.d/99-mutter-no-rt.conf".text = '' + MUTTER_DEBUG_KMS_THREAD_TYPE=user; + ''; + */ + # Additional Gnome configurations via home-manager. dconf.settings = lib.mkIf osConfig.aux.system.ui.desktops.gnome.enable { "org/gnome/mutter" = {