From 6ba14c1b7f39ecf86ab710ad93734b331b319b4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Fri, 12 Aug 2022 09:54:52 +0200 Subject: nixos: add Turris Mox red LED configuration --- nixos/modules/turris-moxled.nix | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 nixos/modules/turris-moxled.nix (limited to 'nixos/modules') diff --git a/nixos/modules/turris-moxled.nix b/nixos/modules/turris-moxled.nix new file mode 100644 index 0000000..2a40f62 --- /dev/null +++ b/nixos/modules/turris-moxled.nix @@ -0,0 +1,27 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + + options = { + turris.moxled = mkOption { + type = types.bool; + default = true; + description = "Turris Mox CPU modul LED. Set to false to disable it."; + }; + }; + + config = mkIf (config.turris.board == "mox") { + + systemd.services."mox-redled" = { + script = if config.turris.moxled then + "echo heartbeat > /sys/class/leds/red/trigger" + else + "echo 0 > /sys/class/leds/red/brightness" + ""; + wantedBy = [ "multi-user.target" ]; + }; + + }; +} -- cgit v1.2.3