diff options
author | Benjamin Chausse <benjamin@chausse.xyz> | 2024-12-20 22:17:32 -0500 |
---|---|---|
committer | Benjamin Chausse <benjamin@chausse.xyz> | 2024-12-20 22:17:32 -0500 |
commit | fa7c8c14fe1d3f72b60773efd6ab50c438e105d7 (patch) | |
tree | e2e27bc0fc0036c43d80f17da12bb1057eec5aa1 /common/rgb.nix | |
parent | 90854019fc940473a0ce4fff29c402e54841f704 (diff) |
Kill All RGB
Diffstat (limited to 'common/rgb.nix')
-rw-r--r-- | common/rgb.nix | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/common/rgb.nix b/common/rgb.nix new file mode 100644 index 0000000..d33f7db --- /dev/null +++ b/common/rgb.nix @@ -0,0 +1,30 @@ +{ services, networking, pkgs, lib, ... }: + +let + no-rgb = pkgs.writeScriptBin "no-rgb" '' + #!/bin/sh + NUM_DEVICES=$(${pkgs.openrgb}/bin/openrgb --noautoconnect --list-devices | grep -E '^[0-9]+: ' | wc -l) + + for i in $(seq 0 $(($NUM_DEVICES - 1))); do + ${pkgs.openrgb}/bin/openrgb --noautoconnect --device $i --mode static --color 000000 + done + ''; +in { + # Uncomment if using a firewall and need to allow SSH connections + # networking.firewall.allowedTCPPorts = [22]; + + # RGB-related configuration + services.udev.packages = [ pkgs.openrgb ]; + boot.kernelModules = [ "i2c-dev" ]; + hardware.i2c.enable = true; + + systemd.services.no-rgb = { + description = "Disable RGB lighting"; + serviceConfig = { + ExecStart = "${no-rgb}/bin/no-rgb"; + Type = "oneshot"; + }; + wantedBy = [ "multi-user.target" ]; + }; +} + |