From a5f34daeeb61af0a2f03cbd34737394d91aeb4a1 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Thu, 14 Nov 2024 11:28:57 +0100 Subject: [PATCH] nixos/g810-led: init --- nixos/modules/services/hardware/g810-led.nix | 45 ++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 nixos/modules/services/hardware/g810-led.nix diff --git a/nixos/modules/services/hardware/g810-led.nix b/nixos/modules/services/hardware/g810-led.nix new file mode 100644 index 000000000000..25472f0ac1e6 --- /dev/null +++ b/nixos/modules/services/hardware/g810-led.nix @@ -0,0 +1,45 @@ +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.services.g810-led; +in +{ + options = { + services.g810-led = { + enable = lib.mkEnableOption "g810-led, a Linux LED controller for some Logitech G Keyboards"; + + package = lib.mkPackageOption pkgs "g810-led" { }; + + profile = lib.mkOption { + type = lib.types.nullOr lib.types.lines; + default = null; + example = '' + # G810-LED Profile (turn all keys on) + + # Set all keys on + a ffffff + + # Commit changes + c + ''; + description = '' + Keyboard profile to apply at boot time. + + The upstream repository provides [example configurations](https://github.com/MatMoul/g810-led/tree/master/sample_profiles). + ''; + }; + }; + }; + + config = lib.mkIf cfg.enable { + environment.etc."g810-led/profile" = lib.mkIf (cfg.profile != null) cfg.profile; + + services.udev.packages = [ config.package ]; + }; + + meta.maintainers = with lib.maintainers; [ GaetanLepage ]; +}