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/default.nix | 3 ++- nixos/modules/turris-moxled.nix | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 nixos/modules/turris-moxled.nix (limited to 'nixos') diff --git a/nixos/default.nix b/nixos/default.nix index 080ec0d..d8930eb 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -3,9 +3,10 @@ self: let modules = { turris-board = import ./modules/turris-board.nix; + turris-crossbuild = import ./modules/turris-crossbuild.nix; turris-defaults = import ./modules/turris-defaults.nix; + turris-moxled = import ./modules/turris-moxled.nix; turris-tarball = import ./modules/turris-tarball.nix; - turris-crossbuild = import ./modules/turris-crossbuild.nix; armv7l-overlay = import ./modules/armv7l-overlay.nix; 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