aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/scripts/pushover/default.nix61
1 files changed, 30 insertions, 31 deletions
diff --git a/modules/scripts/pushover/default.nix b/modules/scripts/pushover/default.nix
index f20a5be..cedfb20 100644
--- a/modules/scripts/pushover/default.nix
+++ b/modules/scripts/pushover/default.nix
@@ -1,41 +1,40 @@
{ inputs, config, pkgs, ... }:
let
- pushover =
- pkgs.writeShellScriptBin "pushover" ''
- #!/bin/sh
+ pushover = pkgs.writeShellScriptBin "pushover" ''
+ #!/bin/sh
- die() { echo "$0: $*" >&2; exit 111; }
+ die() { echo "$0: $*" >&2; exit 111; }
- APP=$(cat ${config.age.secrets.pushoverAppToken.path})
- USER=$(cat ${config.age.secrets.pushoverUserToken.path})
+ APP=$(cat ${config.age.secrets.pushoverAppToken.path})
+ USER=$(cat ${config.age.secrets.pushoverUserToken.path})
- while getopts ":t:" args; do
- case "$args" in
- t)
- TITLE="$OPTARG"
- ;;
- :)
- die "missing option argument for -$OPTARG"
- ;;
- *)
- die "invalid option -$OPTARG"
- ;;
- esac
- done
- shift $((OPTIND - 1))
+ while getopts ":t:" args; do
+ case "$args" in
+ t)
+ TITLE="$OPTARG"
+ ;;
+ :)
+ die "missing option argument for -$OPTARG"
+ ;;
+ *)
+ die "invalid option -$OPTARG"
+ ;;
+ esac
+ done
+ shift $((OPTIND - 1))
- MESSAGE="$*"
- if [ -z "$MESSAGE" ] || [ "$MESSAGE" = " " ]; then
- MESSAGE="No errors to report."
- fi
+ MESSAGE="$*"
+ if [ -z "$MESSAGE" ] || [ "$MESSAGE" = " " ]; then
+ MESSAGE="No errors to report."
+ fi
- /run/current-system/sw/bin/curl -s \
- --form-string "token=$APP" \
- --form-string "user=$USER" \
- --form-string "title=$TITLE" \
- --form-string "message=$MESSAGE" \
- https://api.pushover.net/1/messages.json
- '';
+ /run/current-system/sw/bin/curl -s \
+ --form-string "token=$APP" \
+ --form-string "user=$USER" \
+ --form-string "title=$TITLE" \
+ --form-string "message=$MESSAGE" \
+ https://api.pushover.net/1/messages.json
+ '';
in
{
age.secrets = {