diff options
author | Karel Kočí <cynerd@email.cz> | 2022-08-12 09:54:52 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2022-08-12 09:54:52 +0200 |
commit | 6ba14c1b7f39ecf86ab710ad93734b331b319b4d (patch) | |
tree | e62f24ba24cccf14224452c3e5b55ef36516dab2 | |
parent | 07896ee61dba47bc57c4c3b3b819033dc0324a1b (diff) | |
download | nixturris-6ba14c1b7f39ecf86ab710ad93734b331b319b4d.tar.gz nixturris-6ba14c1b7f39ecf86ab710ad93734b331b319b4d.tar.bz2 nixturris-6ba14c1b7f39ecf86ab710ad93734b331b319b4d.zip |
nixos: add Turris Mox red LED configuration
-rw-r--r-- | nixos/default.nix | 3 | ||||
-rw-r--r-- | nixos/modules/turris-moxled.nix | 27 |
2 files changed, 29 insertions, 1 deletions
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" ]; + }; + + }; +} |