module-example.nix (694B)
1 { config, lib, pkgs, ... }: 2 let 3 grafana-sms-alert = pkgs.callPackage (fetchTarball "https://gti.telent.net/dan/grafana-sms-alert/archive/main.tar.gz") {}; 4 smsConfig = builtins.toFile "config.json" 5 (builtins.toJSON { 6 smsc = "+447958879879"; 7 number = "447000123456"; 8 device = "/dev/serial/by-id/usb-HUAWEI_HUAWEI_HiLink-if00-port0"; 9 }); 10 in { 11 config.systemd.services.grafana-sms = { 12 description = "SMS webhook for Grafana"; 13 wantedBy = [ "multi-user.target" ]; 14 serviceConfig = { 15 Restart = "always"; 16 SyslogIdentifier = "grafana-sms"; 17 ExecStart = '' 18 ${grafana-sms-alert}/bin/grafana-sms-alert ${smsConfig} 19 ''; 20 }; 21 }; 22 }