{ config, pkgs, ... }: let getLatestN = writeShellApplication { name = "misskey-getLatestN"; runtimeInputs = [ curl jq ]; text = '' if [[ -a /tmp/${config.networking.hostName}/misskey-scripts/getLatestN.fifo ]]; then mkdir -p /tmp/${config.networking.hostName}/misskey-scripts mkfifo /tmp/${config.networking.hostName}/misskey-scripts/getLatestN.fifo fi pipeLocation=/tmp/${config.networking.hostName}/misskey-scripts/getLatestN.fifo curl https://misskey.io/api/notes -s --request POST --header 'Content-Type: application/json' --data '{"local": true, "reply": false, "renote": false, "withFiles": false, "poll": false, "limit": $1}' > "$pipeLocation" & echo "$(jq -M -r '.[].text' < $pipeLocation)" > $pipeLocation & while read line; do echo "$line" done < $pipeLocation wait ''; }; in pkgs.symlinkJoin { name = "misskey-scripts"; paths = [ getLatestN ]; }