aboutsummaryrefslogtreecommitdiff
path: root/nixos/modules
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/turris-moxled.nix27
1 files changed, 27 insertions, 0 deletions
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" ];
+ };
+
+ };
+}