aboutsummaryrefslogtreecommitdiff
path: root/nixos/modules
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2022-08-12 09:54:52 +0200
committerKarel Kočí <cynerd@email.cz>2022-08-12 09:54:52 +0200
commit6ba14c1b7f39ecf86ab710ad93734b331b319b4d (patch)
treee62f24ba24cccf14224452c3e5b55ef36516dab2 /nixos/modules
parent07896ee61dba47bc57c4c3b3b819033dc0324a1b (diff)
downloadnixturris-6ba14c1b7f39ecf86ab710ad93734b331b319b4d.tar.gz
nixturris-6ba14c1b7f39ecf86ab710ad93734b331b319b4d.tar.bz2
nixturris-6ba14c1b7f39ecf86ab710ad93734b331b319b4d.zip
nixos: add Turris Mox red LED configuration
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" ];
+ };
+
+ };
+}