aboutsummaryrefslogtreecommitdiff
path: root/nixos/modules/turris-moxled.nix
blob: 2a40f62a725dc113579f917095ebcc0dc61d3d94 (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/red/trigger"
        else
          "echo 0 > /sys/class/leds/red/brightness"
          "";
      wantedBy = [ "multi-user.target" ];
    };

  };
}