1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00

feat: fix secrets permissions, move ./packages to flake outputs

This commit is contained in:
2023-02-24 23:10:45 +01:00
parent c51db2b53c
commit c9af430f31
118 changed files with 1201 additions and 2107 deletions

81
packages/pls.nix Normal file
View File

@@ -0,0 +1,81 @@
{
lib,
writers,
miller,
gnused,
curl,
nur,
}: let
playlistAPI = "https://radio.lassul.us";
sendIRC = writers.writeDash "send-irc" ''
${nur.repos.mic92.ircsink}/bin/ircsink \
--nick musikkritiker \
--server irc.hackint.org \
--port 6697 \
--secure \
--target '#the_playlist' >/dev/null 2>&1
'';
messages.good = [
"what a banger"
"ooh i love this song"
"this is top notch stuff!"
"nice!"
"noice!"
"yesss!"
"cool song!"
"i like this"
"that just sounds awesome!"
"that's a good song!"
"👍"
"vibin'"
];
messages.bad = [
"how can anyone listen to this?"
"(°° "
"skip this!"
"next, please! i'm suffering!"
"that's just bad music"
"nope"
"that sucks!"
"👎"
"turn that down"
"make it stooop"
"noooo"
];
messages.neutral = [
"meh"
"i have no opinion about this song"
"idk man"
];
in
writers.writeDashBin "pls" ''
case "$1" in
good|like|cool|nice|noice|top|yup|yass|yes|+)
${curl}/bin/curl -sS -XPOST "${playlistAPI}/good"
echo ${lib.escapeShellArg (lib.concatStringsSep "\n" messages.good)} | shuf -n1 | ${sendIRC}
;;
skip|next|bad|sucks|no|nope|flop|-)
${curl}/bin/curl -sS -XPOST "${playlistAPI}/skip"
echo ${lib.escapeShellArg (lib.concatStringsSep "\n" messages.bad)} | shuf -n1 | ${sendIRC}
;;
0|meh|neutral)
echo ${lib.escapeShellArg (lib.concatStringsSep "\n" messages.neutral)} | shuf -n1 | ${sendIRC}
;;
say|msg)
shift
echo "$@" | ${sendIRC}
;;
recent)
${curl}/bin/curl -sS -XGET "${playlistAPI}/recent" | tac | head
;;
*)
${curl}/bin/curl -sS -XGET "${playlistAPI}/current" \
| ${miller}/bin/mlr --ijson --oxtab cat \
| ${gnused}/bin/sed -n '/artist\|title\|youtube/p'
;;
esac
wait
''