aboutsummaryrefslogtreecommitdiff
path: root/nixos/modules/turris-moxled.nix
blob: f364908eba900974e4eeede367df49a1a06c3bee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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/mox:red:activity/trigger"
        else
          "echo 0 > /sys/class/leds/mox:red:activity/brightness"
          "";
      wantedBy = [ "multi-user.target" ];
    };

  };
}