aboutsummaryrefslogtreecommitdiff
path: root/modules/nixos/hardware/rgb
diff options
context:
space:
mode:
authorCaroline Larimore <caroline@larimo.re>2025-05-03 13:29:29 -0700
committerCaroline Larimore <caroline@larimo.re>2025-05-03 13:29:29 -0700
commit2ce64b8273bf239c2c6c3a65e3372c4344933ee5 (patch)
tree16d87af64ff95cb601ee7beef5d60d839fc4d1f1 /modules/nixos/hardware/rgb
parentcc337816ee3d657859ab11bdd9118d50a9629c92 (diff)
c-pc: magic headphone rbg script
Diffstat (limited to 'modules/nixos/hardware/rgb')
-rw-r--r--modules/nixos/hardware/rgb/default.nix32
1 files changed, 32 insertions, 0 deletions
diff --git a/modules/nixos/hardware/rgb/default.nix b/modules/nixos/hardware/rgb/default.nix
new file mode 100644
index 0000000..81e633f
--- /dev/null
+++ b/modules/nixos/hardware/rgb/default.nix
@@ -0,0 +1,32 @@
+{ options, config, lib, pkgs, namespace, ... }:
+
+with lib; with lib.${namespace}; let
+ cfg = config.${namespace}.hardware.rgb;
+in {
+ options.${namespace}.hardware.rgb = with types; {
+ enable = mkEnableOption "rgb support";
+ headphones = mkEnableOption "headphone support";
+ };
+
+ config = mkIf cfg.enable {
+ # magic shit :3
+ systemd.services."${namespace}.headphone-rgb-disable" = let
+ id = "046D:0B1F";
+ magic = "11 ff 08 00 0e";
+ command = "${pkgs.openrgb}/bin/openrgb -d 'G733 Gaming Headset' --mode off";
+ script = pkgs.writeShellScript "headphone-rgb-disable" ''
+ ${command}
+ ${pkgs.gnugrep}/bin/grep --line-buffered -F '${magic}' /sys/kernel/debug/hid/*:${id}.*/events | while read; do ${command}; done
+ '';
+ in {
+ enable = cfg.headphones;
+ wantedBy = [ "multi-user.target" ];
+ serviceConfig.ExecStart = script;
+ };
+
+ services = {
+ hardware.openrgb.enable = true;
+ udev.enable = true;
+ };
+ };
+}