45 lines
825 B
Nix
45 lines
825 B
Nix
{pkgs ? import <nixpkgs> {} }:
|
|
|
|
pkgs.mkShell {
|
|
buildInputs = [
|
|
pkgs.cbonsai
|
|
pkgs.cmatrix
|
|
pkgs.neo-cowsay
|
|
pkgs.fortune
|
|
pkgs.nyancat
|
|
pkgs.coreutils
|
|
];
|
|
|
|
shellHook = ''
|
|
STIME=60
|
|
programs="cmatrix cbonsai nyancat fortuneCow"
|
|
|
|
trap 'stty sane; tput cnorm; clear' EXIT
|
|
|
|
while true; do
|
|
choice=$(echo "$programs" | tr ' ' '\n' | shuf -n 1)
|
|
clear
|
|
tput sgr0
|
|
case "$choice" in
|
|
cbonsai)
|
|
cbonsai -l -t 1 & pid=$!
|
|
( sleep "$STIME" && kill $pid ) & watcher=$!
|
|
wait $pid 2>/dev/null
|
|
kill $watcher 2>/dev/null || true
|
|
;;
|
|
cmatrix)
|
|
bash -c "cmatrix -u 4 & pid=\$!; sleep $STIME; kill -INT \$pid; wait \$pid"
|
|
;;
|
|
nyancat)
|
|
timeout "$STIME" nyancat
|
|
;;
|
|
fortuneCow)
|
|
fortune | cowsay
|
|
sleep "$STIME"
|
|
;;
|
|
esac
|
|
sleep 1
|
|
done
|
|
'';
|
|
}
|